]> git.nega.tv - josh/narcissus/commitdiff
Fix new clippy lints
authorJoshua Simmons <josh@nega.tv>
Sat, 28 Jan 2023 10:01:31 +0000 (11:01 +0100)
committerJoshua Simmons <josh@nega.tv>
Sat, 28 Jan 2023 10:01:31 +0000 (11:01 +0100)
Mostly switching to inline formatting.

narcissus-core/src/arena.rs
narcissus-core/src/fixed_vec.rs
narcissus-core/src/obj.rs
narcissus-core/src/virtual_mem.rs
narcissus-maths/src/lib.rs
narcissus-maths/src/mat2.rs
narcissus-maths/src/mat3.rs
narcissus-maths/src/mat4.rs
narcissus-maths/tests/exhaustive_f32.rs

index a3c25e34a2998a90e59f0b4d44a2a567227ecbb6..9d23d211e7ee5db7f0e959f933aff2cca1080929 100644 (file)
@@ -7,7 +7,7 @@ pub struct AllocError;
 
 impl std::fmt::Display for AllocError {
     fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
-        write!(f, "{:?}", self)
+        write!(f, "{self:?}")
     }
 }
 
index c9d33044116a81ee3aaf93222b244c8c3508e61f..d76fcd672afb2955b5807ac1ee1a3ba4a4ddf571 100644 (file)
@@ -109,8 +109,7 @@ impl<T, const CAP: usize> FixedVec<T, CAP> {
         #[inline(never)]
         fn assert_failed(index: usize, len: usize) -> ! {
             panic!(
-                "swap_remove index (is {}) should be < len (is {})",
-                index, len
+                "swap_remove index (is {index}) should be < len (is {len})"
             );
         }
 
@@ -135,8 +134,7 @@ impl<T, const CAP: usize> FixedVec<T, CAP> {
         #[inline(never)]
         fn assert_failed(index: usize, len: usize) -> ! {
             panic!(
-                "insertion index (is {}) should be <= len (is {})",
-                index, len
+                "insertion index (is {index}) should be <= len (is {len})"
             );
         }
 
@@ -147,7 +145,7 @@ impl<T, const CAP: usize> FixedVec<T, CAP> {
 
         // space for the new element
         if len == CAP {
-            panic!("buffer is full (capacity is {})", CAP);
+            panic!("buffer is full (capacity is {CAP})");
         }
 
         unsafe {
@@ -172,7 +170,7 @@ impl<T, const CAP: usize> FixedVec<T, CAP> {
         #[inline(never)]
         #[track_caller]
         fn assert_failed(index: usize, len: usize) -> ! {
-            panic!("removal index (is {}) should be < len (is {})", index, len);
+            panic!("removal index (is {index}) should be < len (is {len})");
         }
 
         let len = self.len();
@@ -439,7 +437,7 @@ impl<T, const CAP: usize> FixedVec<T, CAP> {
     #[inline]
     pub fn push(&mut self, value: T) {
         if self.len == CAP {
-            panic!("capacity overflow (is {})", CAP);
+            panic!("capacity overflow (is {CAP})");
         }
         unsafe {
             let end = self.as_mut_ptr().add(self.len);
index 5d9e80fe4dec784047fc2248441e5477ca9ed176..836d51e773dd1ad70a82fbcca3f8a6628335a8b9 100644 (file)
@@ -12,7 +12,7 @@ pub enum Error {
 
 impl std::fmt::Display for Error {
     fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
-        write!(f, "{:?}", self)
+        write!(f, "{self:?}")
     }
 }
 
index ac72a46d216f2ebdb4d969a3c26dff931d7e3679..9b660015d17389d3a6fb185f310530a3740f5946 100644 (file)
@@ -7,7 +7,7 @@ pub enum MapError {
 
 impl std::fmt::Display for MapError {
     fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
-        write!(f, "{:?}", self)
+        write!(f, "{self:?}")
     }
 }
 
index 6934e744bc3a238e58ecbd37c351b123939ba2ef..cb88a6f390e9e1bb36c7a11f2e182c3b38027a23 100644 (file)
@@ -182,7 +182,7 @@ fn round_ties_to_even(x: f32) -> f32 {
         use std::arch::x86_64::{
             _mm_load_ss, _mm_round_ss, _MM_FROUND_NO_EXC, _MM_FROUND_TO_NEAREST_INT,
         };
-        const ROUNDING: i32 = (_MM_FROUND_TO_NEAREST_INT | _MM_FROUND_NO_EXC) as i32;
+        const ROUNDING: i32 = _MM_FROUND_TO_NEAREST_INT | _MM_FROUND_NO_EXC;
         let x = _mm_load_ss(&x);
         let x = _mm_round_ss::<ROUNDING>(x, x);
         std::arch::x86_64::_mm_cvtss_f32(x)
index c6d1b1b2e06b6aa83dcab67fb2d21fdf5493eed8..196bea72f85f5ad542e05769b50f13cab54d3841 100644 (file)
@@ -10,7 +10,7 @@ impl std::fmt::Debug for Mat2 {
         if f.alternate() {
             writeln!(f, "Mat2 [")?;
             for row in self.as_rows() {
-                writeln!(f, "\t{:?}", row)?;
+                writeln!(f, "\t{row:?}")?;
             }
             writeln!(f, "]")
         } else {
index af44149e7151357dcb71bed43c26eb794b04961c..520eaddeba8d61c6bbb775ec9a3ae3d9780ec40e 100644 (file)
@@ -10,7 +10,7 @@ impl std::fmt::Debug for Mat3 {
         if f.alternate() {
             writeln!(f, "Mat3 [")?;
             for row in self.as_rows() {
-                writeln!(f, "\t{:?}", row)?;
+                writeln!(f, "\t{row:?}")?;
             }
             writeln!(f, "]")
         } else {
index afa71044229656ced77db6c25b2c46c587d974d8..9a8409e010e2d2f39d2295ef1d95b75433d36095 100644 (file)
@@ -12,7 +12,7 @@ impl std::fmt::Debug for Mat4 {
         if f.alternate() {
             writeln!(f, "Mat4 [")?;
             for row in self.as_rows() {
-                writeln!(f, "\t{:?}", row)?;
+                writeln!(f, "\t{row:?}")?;
             }
             writeln!(f, "]")
         } else {
index 0fcc12fbb8f8dcb91fe95d4c025159f6681f0fb7..a522a54fd2f75be63f9122cbba71e9f9536fa373 100644 (file)
@@ -422,7 +422,7 @@ fn ref_tan_pi_f32(x: &mut Float, pi: &Float) -> i32 {
 #[ignore]
 pub fn exhaustive_sin_pi() {
     let errors = check_exhaustive_f32(ref_sin_pi_f32, |a| sin_cos_pi_f32(a).0, false);
-    println!("SIN: {:?}", errors);
+    println!("SIN: {errors:?}");
     assert_eq!(errors.max_error_ulp, 1);
     assert_eq!(errors.num_errors, 55_943_962);
 }
@@ -431,7 +431,7 @@ pub fn exhaustive_sin_pi() {
 #[ignore]
 pub fn exhaustive_cos_pi() {
     let errors = check_exhaustive_f32(ref_cos_pi_f32, |a| sin_cos_pi_f32(a).1, false);
-    println!("COS: {:?}", errors);
+    println!("COS: {errors:?}");
     assert_eq!(errors.num_errors, 45_896_848);
     assert_eq!(errors.max_error_ulp, 1);
 }
@@ -440,7 +440,7 @@ pub fn exhaustive_cos_pi() {
 #[ignore]
 pub fn exhaustive_tan_pi() {
     let errors = check_exhaustive_f32(ref_tan_pi_f32, tan_pi_f32, true);
-    println!("TAN: {:?}", errors);
+    println!("TAN: {errors:?}");
     assert_eq!(errors.num_errors, 100_555_422);
     assert_eq!(errors.max_error_ulp, 2);
 }