diff --git a/nalgebra-sparse/src/csc.rs b/nalgebra-sparse/src/csc.rs index 65e1c409..a691e1d4 100644 --- a/nalgebra-sparse/src/csc.rs +++ b/nalgebra-sparse/src/csc.rs @@ -329,6 +329,7 @@ impl CscMatrix { /// Mutable column access for the given column index, or `None` if out of bounds. #[inline] + #[must_use] pub fn get_col_mut(&mut self, index: usize) -> Option> { self.cs.get_lane_mut(index).map(|lane| CscColMut { lane }) } @@ -691,6 +692,7 @@ impl<'a, T> CscColMut<'a, T> { } /// Returns a mutable entry for the given global row index. + #[must_use] pub fn get_entry_mut(&mut self, global_row_index: usize) -> Option> { self.lane.get_entry_mut(global_row_index) } diff --git a/nalgebra-sparse/src/csr.rs b/nalgebra-sparse/src/csr.rs index 86b4272c..c2f9b669 100644 --- a/nalgebra-sparse/src/csr.rs +++ b/nalgebra-sparse/src/csr.rs @@ -331,6 +331,7 @@ impl CsrMatrix { /// Mutable row access for the given row index, or `None` if out of bounds. #[inline] + #[must_use] pub fn get_row_mut(&mut self, index: usize) -> Option> { self.cs.get_lane_mut(index).map(|lane| CsrRowMut { lane }) } @@ -695,6 +696,7 @@ impl<'a, T> CsrRowMut<'a, T> { /// Returns a mutable entry for the given global column index. #[inline] + #[must_use] pub fn get_entry_mut(&mut self, global_col_index: usize) -> Option> { self.lane.get_entry_mut(global_col_index) } diff --git a/src/base/indexing.rs b/src/base/indexing.rs index 9ddf8776..5bc06020 100644 --- a/src/base/indexing.rs +++ b/src/base/indexing.rs @@ -496,6 +496,7 @@ impl> Matrix { /// Produces a mutable view of the data at the given index, or /// `None` if the index is out of bounds. #[inline] + #[must_use] pub fn get_mut<'a, I>(&'a mut self, index: I) -> Option where S: StorageMut, @@ -540,6 +541,7 @@ impl> Matrix { /// Returns a mutable view of the data at the given index, without doing /// any bounds checking. #[inline] + #[must_use] pub unsafe fn get_unchecked_mut<'a, I>(&'a mut self, index: I) -> I::OutputMut where S: StorageMut, diff --git a/src/base/matrix.rs b/src/base/matrix.rs index 6d2468bb..5214bb6f 100644 --- a/src/base/matrix.rs +++ b/src/base/matrix.rs @@ -1266,6 +1266,7 @@ impl> Vector { impl> Vector { /// Gets a mutable reference to the i-th element of this column vector without bound checking. #[inline] + #[must_use] pub unsafe fn vget_unchecked_mut(&mut self, i: usize) -> &mut T { debug_assert!(i < self.nrows(), "Vector index out of bounds."); let i = i * self.strides().0; @@ -1285,6 +1286,7 @@ impl> Matrix> Matrix { /// Extracts a mutable slice containing the entire matrix entries ordered column-by-columns. #[inline] + #[must_use] pub fn as_mut_slice(&mut self) -> &mut [T] { self.data.as_mut_slice() } diff --git a/src/geometry/point.rs b/src/geometry/point.rs index 89db12cc..d25b4d7c 100644 --- a/src/geometry/point.rs +++ b/src/geometry/point.rs @@ -277,6 +277,7 @@ impl Point { /// Gets a mutable reference to i-th element of this point without bound-checking. #[inline] + #[must_use] pub unsafe fn get_unchecked_mut(&mut self, i: usize) -> &mut T { self.coords.vget_unchecked_mut(i) }