Merge pull request #1271 from waywardmonkeys/incorrect-usages-of-relative-eq

Use `assert_relative_eq!` instead of relative_eq!`.
This commit is contained in:
Andreas Borgen Longva 2023-08-14 08:51:22 +02:00 committed by GitHub
commit ec9a88c0ac
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 5 deletions

View File

@ -97,7 +97,7 @@ where
/// ///
/// let dq_normalized = dq.normalize(); /// let dq_normalized = dq.normalize();
/// ///
/// relative_eq!(dq_normalized.real.norm(), 1.0); /// assert_relative_eq!(dq_normalized.real.norm(), 1.0);
/// ``` /// ```
#[inline] #[inline]
#[must_use = "Did you mean to use normalize_mut()?"] #[must_use = "Did you mean to use normalize_mut()?"]
@ -122,7 +122,7 @@ where
/// ///
/// dq.normalize_mut(); /// dq.normalize_mut();
/// ///
/// relative_eq!(dq.real.norm(), 1.0); /// assert_relative_eq!(dq.real.norm(), 1.0);
/// ``` /// ```
#[inline] #[inline]
pub fn normalize_mut(&mut self) -> T { pub fn normalize_mut(&mut self) -> T {

View File

@ -138,7 +138,7 @@ where
/// # use nalgebra::Quaternion; /// # use nalgebra::Quaternion;
/// let q = Quaternion::new(1.0, 2.0, 3.0, 4.0); /// let q = Quaternion::new(1.0, 2.0, 3.0, 4.0);
/// let q_normalized = q.normalize(); /// let q_normalized = q.normalize();
/// relative_eq!(q_normalized.norm(), 1.0); /// assert_relative_eq!(q_normalized.norm(), 1.0);
/// ``` /// ```
#[inline] #[inline]
#[must_use = "Did you mean to use normalize_mut()?"] #[must_use = "Did you mean to use normalize_mut()?"]

View File

@ -36,8 +36,8 @@ fn main() {
let angle = 1.57; let angle = 1.57;
let b = Rotation3::from_axis_angle(&axis, angle); let b = Rotation3::from_axis_angle(&axis, angle);
relative_eq!(b.axis().unwrap(), axis); assert_relative_eq!(b.axis().unwrap(), axis);
relative_eq!(b.angle(), angle); assert_relative_eq!(b.angle(), angle);
} }
``` ```