From e1fe76235f879094da59f142699e00f420fd80e2 Mon Sep 17 00:00:00 2001 From: Malte Tammena Date: Mon, 7 Jun 2021 16:44:59 +0200 Subject: [PATCH] Normalize `#[must_use]` hints --- src/base/norm.rs | 4 ++-- src/lib.rs | 4 ++-- src/linalg/cholesky.rs | 2 +- src/linalg/exp.rs | 2 +- src/sparse/cs_matrix_solve.rs | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/base/norm.rs b/src/base/norm.rs index d0c96cd3..09e11f7e 100644 --- a/src/base/norm.rs +++ b/src/base/norm.rs @@ -349,7 +349,7 @@ impl> Matrix { /// Returns a new vector with the same magnitude as `self` clamped between `0.0` and `max`. #[inline] - #[must_use = "This function does not mutate self but returns a new clamped version."] + #[must_use] pub fn cap_magnitude(&self, max: T::RealField) -> OMatrix where T: ComplexField, @@ -366,7 +366,7 @@ impl> Matrix { /// Returns a new vector with the same magnitude as `self` clamped between `0.0` and `max`. #[inline] - #[must_use = "This function does not mutate self but returns a new clamped version."] + #[must_use] pub fn simd_cap_magnitude(&self, max: T::SimdRealField) -> OMatrix where T: SimdComplexField, diff --git a/src/lib.rs b/src/lib.rs index f0f62fe1..a978d5f5 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -184,7 +184,7 @@ pub fn zero() -> T { /// Wraps `val` into the range `[min, max]` using modular arithmetics. /// /// The range must not be empty. -#[must_use = "This function does not mutate `val`."] +#[must_use] #[inline] pub fn wrap(mut val: T, min: T, max: T) -> T where @@ -220,7 +220,7 @@ where /// * If `min < val < max`, this returns `val`. /// * If `val <= min`, this returns `min`. /// * If `val >= max`, this returns `max`. -#[must_use = "This function does not mutate `val`."] +#[must_use] #[inline] pub fn clamp(val: T, min: T, max: T) -> T { if val > min { diff --git a/src/linalg/cholesky.rs b/src/linalg/cholesky.rs index 1e352560..f66fb42f 100644 --- a/src/linalg/cholesky.rs +++ b/src/linalg/cholesky.rs @@ -134,7 +134,7 @@ where } /// Computes the inverse of the decomposed matrix. - #[must_use = "This function does not mutate self. Consider using the return value or dropping the function call."] + #[must_use] pub fn inverse(&self) -> OMatrix { let shape = self.chol.data.shape(); let mut res = OMatrix::identity_generic(shape.0, shape.1); diff --git a/src/linalg/exp.rs b/src/linalg/exp.rs index b93055c5..acb2b9e3 100644 --- a/src/linalg/exp.rs +++ b/src/linalg/exp.rs @@ -435,7 +435,7 @@ where + Allocator, { /// Computes exponential of this matrix - #[must_use = "This function does not mutate self. Consider using the return value or dropping the function call."] + #[must_use] pub fn exp(&self) -> Self { // Simple case if self.nrows() == 1 { diff --git a/src/sparse/cs_matrix_solve.rs b/src/sparse/cs_matrix_solve.rs index 33d811cf..43c5c2c7 100644 --- a/src/sparse/cs_matrix_solve.rs +++ b/src/sparse/cs_matrix_solve.rs @@ -137,7 +137,7 @@ impl> CsMatrix { } /// Solve a lower-triangular system with a sparse right-hand-side. - #[must_use = "This function has no side effects. Consider using the return value or removing the function call."] + #[must_use] pub fn solve_lower_triangular_cs( &self, b: &CsVector,