]> git.nega.tv - josh/narcissus/commitdiff
narcissus: Fix clippy lints
authorJosh Simmons <josh@nega.tv>
Tue, 18 Jun 2024 20:50:00 +0000 (22:50 +0200)
committerJosh Simmons <josh@nega.tv>
Tue, 18 Jun 2024 20:50:00 +0000 (22:50 +0200)
engine/narcissus-core/src/arena.rs
engine/narcissus-core/src/virtual_vec/deque.rs
engine/narcissus-core/src/virtual_vec/raw_vec.rs
engine/narcissus-maths/src/quat.rs

index a13ab01a8e8db8b36a855f25eef787698e5020cf..3520edc4af9cd3716027b93bfa2e9648d164373d 100644 (file)
@@ -173,7 +173,7 @@ unsafe fn prepend_new_page(page: PagePointer, layout: Layout) -> Option<PagePoin
     // Clamp between `PAGE_MIN_SIZE` and `PAGE_MAX_SIZE` to handle the case where
     // the existing page is the empty page, and to avoid overly large allocated
     // blocks.
-    let new_page_size = new_page_size.max(PAGE_MIN_SIZE).min(PAGE_MAX_SIZE);
+    let new_page_size = new_page_size.clamp(PAGE_MIN_SIZE, PAGE_MAX_SIZE);
     // Ensure that after all that, the given page is large enough to hold the thing
     // we're trying to allocate.
     let new_page_size = new_page_size.max(layout.size() + (layout.align() - 1) + PAGE_FOOTER_SIZE);
index 9f947380309994bd8acb179a9e9b7faefc1a4226..44cae4ab2aff7260e38ee796ad8e8b1e304441a5 100644 (file)
@@ -22,7 +22,7 @@ impl<T> VirtualDeque<T> {
 
     pub fn with_capacity(capacity: usize, max_capacity: usize) -> Self {
         assert!(max_capacity.is_power_of_two());
-        assert!(max_capacity < std::isize::MAX as usize);
+        assert!(max_capacity < isize::MAX as usize);
         let cap = std::cmp::max(capacity + 1, MINIMUM_CAPACITY + 1).next_power_of_two();
         Self {
             buf: VirtualRawVec::with_capacity(cap, max_capacity),
index 3280b6c80258e7b66f0448cfa720d9fa6f9b98af..c119cb2c1d543b515570ab22e783fa088ddf5414 100644 (file)
@@ -30,7 +30,7 @@ impl<T> VirtualRawVec<T> {
         let max_capacity_bytes = size.checked_mul(max_capacity).unwrap();
 
         // Check overflow of rounding operation.
-        assert!(max_capacity_bytes <= (std::usize::MAX - (align - 1)));
+        assert!(max_capacity_bytes <= (usize::MAX - (align - 1)));
 
         let ptr = virtual_reserve(max_capacity_bytes).expect("mapping failed");
         let ptr = unsafe { NonNull::new_unchecked(ptr as *mut T) };
index 870d9092a03bcd24fb25d66db67ea99039e8100e..aa6e082a544616c979f2e8024592f41f73490ebe 100644 (file)
@@ -25,10 +25,10 @@ impl Quat {
     };
 
     pub const NAN: Self = Self {
-        a: std::f32::NAN,
-        b: std::f32::NAN,
-        c: std::f32::NAN,
-        d: std::f32::NAN,
+        a: f32::NAN,
+        b: f32::NAN,
+        c: f32::NAN,
+        d: f32::NAN,
     };
 
     /// Create a new quaternion from its components.