From e3078b69e2973afdc34e1c393895b31cefd432e8 Mon Sep 17 00:00:00 2001 From: Alejandro Vaz Date: Sat, 5 Sep 2026 14:51:32 +0200 Subject: [PATCH 1/2] fix: cargo warnings --- src/lib.rs | 4 +++- src/tests.rs | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/lib.rs b/src/lib.rs index f119108..1bacfdc 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -980,6 +980,7 @@ impl SmallVec { // In our case, this also ensures that a smallvec of zero-size items never // spills, and we never try to allocate zero bytes which // `std::alloc::alloc` disallows. + #[allow(deprecated)] core::usize::MAX } } @@ -1469,7 +1470,8 @@ impl SmallVec { } let (lower_size_bound, _) = iter.size_hint(); - assert!(lower_size_bound <= core::isize::MAX as usize); // Ensure offset is indexable + #[allow(deprecated)] + {assert!(lower_size_bound <= core::isize::MAX as usize)} // Ensure offset is indexable assert!(index + lower_size_bound >= index); // Protect against overflow let mut num_added = 0; diff --git a/src/tests.rs b/src/tests.rs index 221a673..fcc8ec2 100644 --- a/src/tests.rs +++ b/src/tests.rs @@ -434,6 +434,7 @@ fn test_invalid_grow() { #[should_panic] fn drain_overflow() { let mut v: SmallVec<[u8; 8]> = smallvec![0]; + #[allow(deprecated)] v.drain(..=std::usize::MAX); } From fa87519a5f0d6c44e6679e9209a61838b980b657 Mon Sep 17 00:00:00 2001 From: Alejandro Vaz Date: Sat, 5 Sep 2026 15:02:01 +0200 Subject: [PATCH 2/2] fix: style formatting --- src/lib.rs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 7b24ad7..d6aad6e 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -985,9 +985,9 @@ impl SmallVec { // `Vec` also does this: // https://github.com/rust-lang/rust/blob/1.44.0/src/liballoc/raw_vec.rs#L186 // - // In our case, this also ensures that a smallvec of zero-size items never - // spills, and we never try to allocate zero bytes which - // `std::alloc::alloc` disallows. + // In our case, this also ensures that a smallvec of zero-size items + // never spills, and we never try to allocate zero bytes + // which `std::alloc::alloc` disallows. #[allow(deprecated)] core::usize::MAX } @@ -1492,7 +1492,9 @@ impl SmallVec { let (lower_size_bound, _) = iter.size_hint(); #[allow(deprecated)] - {assert!(lower_size_bound <= core::isize::MAX as usize)} // Ensure offset is indexable + { + assert!(lower_size_bound <= core::isize::MAX as usize) + } // Ensure offset is indexable assert!(index + lower_size_bound >= index); // Protect against overflow let mut num_added = 0;