Skip to content

Commit 4a9a323

Browse files
committed
Make step_by panic for variants other than Slice
1 parent 4314d72 commit 4a9a323

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/slice.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,8 @@ impl AxisSliceInfo {
140140
///
141141
/// `step` must be nonzero.
142142
/// (This method checks with a debug assertion that `step` is not zero.)
143+
///
144+
/// **Panics** if `self` is not the `AxisSliceInfo::Slice` variant.
143145
#[inline]
144146
pub fn step_by(self, step: isize) -> Self {
145147
debug_assert_ne!(step, 0, "AxisSliceInfo::step_by: step must be nonzero");
@@ -153,8 +155,7 @@ impl AxisSliceInfo {
153155
end,
154156
step: orig_step * step,
155157
},
156-
AxisSliceInfo::Index(s) => AxisSliceInfo::Index(s),
157-
AxisSliceInfo::NewAxis => AxisSliceInfo::NewAxis,
158+
_ => panic!("AxisSliceInfo::step_by: `self` must be the `Slice` variant"),
158159
}
159160
}
160161
}

0 commit comments

Comments
 (0)