Normalize #[must_use] hints

This commit is contained in:
Malte Tammena 2021-06-07 16:44:59 +02:00
parent 9fb963017f
commit e1fe76235f
5 changed files with 7 additions and 7 deletions

View File

@ -349,7 +349,7 @@ impl<T: Scalar, R: Dim, C: Dim, S: Storage<T, R, C>> Matrix<T, R, C, S> {
/// Returns a new vector with the same magnitude as `self` clamped between `0.0` and `max`. /// Returns a new vector with the same magnitude as `self` clamped between `0.0` and `max`.
#[inline] #[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<T, R, C> pub fn cap_magnitude(&self, max: T::RealField) -> OMatrix<T, R, C>
where where
T: ComplexField, T: ComplexField,
@ -366,7 +366,7 @@ impl<T: Scalar, R: Dim, C: Dim, S: Storage<T, R, C>> Matrix<T, R, C, S> {
/// Returns a new vector with the same magnitude as `self` clamped between `0.0` and `max`. /// Returns a new vector with the same magnitude as `self` clamped between `0.0` and `max`.
#[inline] #[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<T, R, C> pub fn simd_cap_magnitude(&self, max: T::SimdRealField) -> OMatrix<T, R, C>
where where
T: SimdComplexField, T: SimdComplexField,

View File

@ -184,7 +184,7 @@ pub fn zero<T: Zero>() -> T {
/// Wraps `val` into the range `[min, max]` using modular arithmetics. /// Wraps `val` into the range `[min, max]` using modular arithmetics.
/// ///
/// The range must not be empty. /// The range must not be empty.
#[must_use = "This function does not mutate `val`."] #[must_use]
#[inline] #[inline]
pub fn wrap<T>(mut val: T, min: T, max: T) -> T pub fn wrap<T>(mut val: T, min: T, max: T) -> T
where where
@ -220,7 +220,7 @@ where
/// * If `min < val < max`, this returns `val`. /// * If `min < val < max`, this returns `val`.
/// * If `val <= min`, this returns `min`. /// * If `val <= min`, this returns `min`.
/// * If `val >= max`, this returns `max`. /// * If `val >= max`, this returns `max`.
#[must_use = "This function does not mutate `val`."] #[must_use]
#[inline] #[inline]
pub fn clamp<T: PartialOrd>(val: T, min: T, max: T) -> T { pub fn clamp<T: PartialOrd>(val: T, min: T, max: T) -> T {
if val > min { if val > min {

View File

@ -134,7 +134,7 @@ where
} }
/// Computes the inverse of the decomposed matrix. /// 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<T, D, D> { pub fn inverse(&self) -> OMatrix<T, D, D> {
let shape = self.chol.data.shape(); let shape = self.chol.data.shape();
let mut res = OMatrix::identity_generic(shape.0, shape.1); let mut res = OMatrix::identity_generic(shape.0, shape.1);

View File

@ -435,7 +435,7 @@ where
+ Allocator<T::RealField, D, D>, + Allocator<T::RealField, D, D>,
{ {
/// Computes exponential of this matrix /// 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 { pub fn exp(&self) -> Self {
// Simple case // Simple case
if self.nrows() == 1 { if self.nrows() == 1 {

View File

@ -137,7 +137,7 @@ impl<T: RealField, D: Dim, S: CsStorage<T, D, D>> CsMatrix<T, D, D, S> {
} }
/// Solve a lower-triangular system with a sparse right-hand-side. /// 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<D2: Dim, S2>( pub fn solve_lower_triangular_cs<D2: Dim, S2>(
&self, &self,
b: &CsVector<T, D2, S2>, b: &CsVector<T, D2, S2>,