Skip to content

Commit 7a3b380

Browse files
committed
Improve code style
1 parent d7039a0 commit 7a3b380

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

src/slice.rs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -451,13 +451,15 @@ where
451451
/// `Din::NDIM.unwrap()`. Otherwise, the value is calculated by iterating
452452
/// over the `AxisSliceInfo` elements.
453453
pub fn in_ndim(&self) -> usize {
454-
Din::NDIM.unwrap_or_else(|| {
454+
if let Some(ndim) = Din::NDIM {
455+
ndim
456+
} else {
455457
self.indices
456458
.as_ref()
457459
.iter()
458460
.filter(|s| !s.is_new_axis())
459461
.count()
460-
})
462+
}
461463
}
462464

463465
/// Returns the number of dimensions after calling
@@ -468,13 +470,15 @@ where
468470
/// `Dout::NDIM.unwrap()`. Otherwise, the value is calculated by iterating
469471
/// over the `AxisSliceInfo` elements.
470472
pub fn out_ndim(&self) -> usize {
471-
Dout::NDIM.unwrap_or_else(|| {
473+
if let Some(ndim) = Dout::NDIM {
474+
ndim
475+
} else {
472476
self.indices
473477
.as_ref()
474478
.iter()
475479
.filter(|s| !s.is_index())
476480
.count()
477-
})
481+
}
478482
}
479483
}
480484

0 commit comments

Comments
 (0)