From: Joshua Simmons Date: Sun, 25 Sep 2022 12:13:41 +0000 (+0200) Subject: Fix some clippy lints and doc errors X-Git-Url: https://git.nega.tv//gitweb.cgi?a=commitdiff_plain;h=dd7f61994cfd0dc761824fe5363d277b99d8939a;p=josh%2Fnarcissus Fix some clippy lints and doc errors --- diff --git a/narcissus-maths/src/lib.rs b/narcissus-maths/src/lib.rs index 3193cd3..0af05bf 100644 --- a/narcissus-maths/src/lib.rs +++ b/narcissus-maths/src/lib.rs @@ -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`.")] diff --git a/narcissus-maths/src/mat4.rs b/narcissus-maths/src/mat4.rs index 85934d5..fe11369 100644 --- a/narcissus-maths/src/mat4.rs +++ b/narcissus-maths/src/mat4.rs @@ -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;