Skip to content

Commit a5a283d

Browse files
committed
API: Add must_use on slice_axis methods
These return views (don't edit the array in place), so must_use is appropriate here.
1 parent 4e31d2f commit a5a283d

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/impl_methods.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -498,6 +498,7 @@ where
498498
///
499499
/// **Panics** if an index is out of bounds or step size is zero.<br>
500500
/// **Panics** if `axis` is out of bounds.
501+
#[must_use = "slice_axis returns an array view with the sliced result"]
501502
pub fn slice_axis(&self, axis: Axis, indices: Slice) -> ArrayView<'_, A, D>
502503
where
503504
S: Data,
@@ -511,6 +512,7 @@ where
511512
///
512513
/// **Panics** if an index is out of bounds or step size is zero.<br>
513514
/// **Panics** if `axis` is out of bounds.
515+
#[must_use = "slice_axis_mut returns an array view with the sliced result"]
514516
pub fn slice_axis_mut(&mut self, axis: Axis, indices: Slice) -> ArrayViewMut<'_, A, D>
515517
where
516518
S: DataMut,

0 commit comments

Comments
 (0)