]> git.nega.tv - josh/narcissus/commitdiff
Fix some clippy lints and doc errors
authorJoshua Simmons <josh@nega.tv>
Sun, 25 Sep 2022 12:13:41 +0000 (14:13 +0200)
committerJoshua Simmons <josh@nega.tv>
Sun, 25 Sep 2022 12:13:41 +0000 (14:13 +0200)
narcissus-maths/src/lib.rs
narcissus-maths/src/mat4.rs

index 3193cd329c1566cdcd20d3f3eada22a1397de66c..0af05bfb67f4a37ef672069abec52972fe9f3924 100644 (file)
@@ -124,6 +124,7 @@ macro_rules! impl_shared {
             pub const ZERO: $name = Self::splat(0.0);
             #[doc = concat!("[`", stringify!($name), "`] with all elements initialized to `1.0`.")]
             pub const ONE: $name = Self::splat(1.0);
+            #[allow(clippy::zero_divided_by_zero)]
             #[doc = concat!("[`", stringify!($name), "`] with all elements initialized to `NaN`.")]
             pub const NAN: $name = Self::splat(0.0 / 0.0);
 
@@ -138,13 +139,13 @@ macro_rules! impl_shared {
             #[doc = concat!("Returns a [`", stringify!($name), "`] where the `i`th element is initialized with the minimum of the corresponding elements `a[i]` and `b[i]`.\n\nThis function returns a platform dependent value if either input is `NaN`. See [`crate::min`] for exact details.")]
             #[inline]
             pub fn min(a: $name, b: $name) -> $name {
-                a.map2(b, |a, b| crate::min(a, b))
+                a.map2(b, |a, b| $crate::min(a, b))
             }
 
             #[doc = concat!("Returns a [`", stringify!($name), "`] where the `i`th element is initialized with the maximum of the corresponding elements `a[i]` and `b[i]`.\n\nThis function returns a platform dependent value if either input is `NaN`. See [`crate::max`] for exact details.")]
             #[inline]
             pub fn max(a: $name, b: $name) -> $name {
-                a.map2(b, |a, b| crate::max(a, b))
+                a.map2(b, |a, b| $crate::max(a, b))
             }
 
             #[doc = concat!("Returns a [`", stringify!($name), "`] where the `i`th element `x[i]` is clamped between the corresponding elements `lo[i]` and `hi[i]`.\n\n# Panics\n\nPanics if any element of `lo` is greater than its corresponding element in `hi`.")]
index 85934d55249f12077ba7a0aa39bfad3d6b49bdb6..fe113695f1b685cbfa85543b45341f246962b39a 100644 (file)
@@ -163,12 +163,12 @@ impl Mat4 {
         ])
     }
 
-    /// Creates an othographic projection matrix with [0,1] depth range.
+    /// Creates an othographic projection matrix with \[0,1\] depth range.
     ///
     /// Destination coordinate space matches native vulkan clip space.
     ///
     /// Src coordinate space: right-handed, +y-up.
-    /// Dst coordinate space: right-handed, -y-up, depth range [0,1].
+    /// Dst coordinate space: right-handed, -y-up, depth range \[0,1\].
     pub fn orthographic_zo(
         left: f32,
         right: f32,
@@ -190,12 +190,12 @@ impl Mat4 {
         ])
     }
 
-    /// Creates a perspective projection matrix with reversed infinite z and [0,1] depth range.
+    /// Creates a perspective projection matrix with reversed infinite z and \[0,1\] depth range.
     ///
     /// Destination coordinate space matches native vulkan clip space.
     ///
     /// Src coordinate space: right-handed, +y up.
-    /// Dst coordinate space: right-handed, -y up, depth range [0,1].
+    /// Dst coordinate space: right-handed, -y up, depth range \[0,1\].
     pub fn perspective_rev_inf_zo(vertical_fov: Rad, aspect_ratio: f32, z_near: f32) -> Mat4 {
         let tan = (vertical_fov.as_f32() / 2.0).tan();
         let sy = 1.0 / tan;