diff --git a/build/main.rs b/build/main.rs index 8041bd2b0a..9da2bac136 100644 --- a/build/main.rs +++ b/build/main.rs @@ -55,7 +55,7 @@ fn main() { _ => { panic!( "${} has an invalid value", - &cargo::env::RING_PREGENERATE_ASM.name + cargo::env::RING_PREGENERATE_ASM.name ); } } diff --git a/cavp/tests/shavs.rs b/cavp/tests/shavs.rs index f5654b195e..31358d01f8 100644 --- a/cavp/tests/shavs.rs +++ b/cavp/tests/shavs.rs @@ -36,7 +36,7 @@ mod digest_shavs { // length is zero. if len_bits == 0 { assert_eq!(msg, &[0u8]); - msg.truncate(0); + msg.clear(); } assert_eq!(msg.len() * 8, len_bits); diff --git a/src/arithmetic/bigint/modulus/mont.rs b/src/arithmetic/bigint/modulus/mont.rs index 23decdb55d..542933bb29 100644 --- a/src/arithmetic/bigint/modulus/mont.rs +++ b/src/arithmetic/bigint/modulus/mont.rs @@ -300,11 +300,11 @@ mod base { // Enforce the length-related invariants (only). let Some((&[.., num_limbs], value)) = storage.split_first_chunk::() else { - return Err(LenMismatchError::new(storage.len()))?; + return Err(LenMismatchError::new(storage.len()).into()); }; let num_limbs = limb::usize_from_limb(num_limbs); if num_limbs != value.len() { - return Err(LenMismatchError::new(storage.len()))?; + return Err(LenMismatchError::new(storage.len()).into()); } if num_limbs < MIN_LIMBS { return Err(LimbSliceError::too_short(num_limbs)); diff --git a/src/testutil.rs b/src/testutil.rs index d365b1aa8d..60a8601f2b 100644 --- a/src/testutil.rs +++ b/src/testutil.rs @@ -440,7 +440,7 @@ fn parse_test_case( Some(line) if line.starts_with('[') => { assert!(is_first_line); assert!(line.ends_with(']')); - current_section.truncate(0); + current_section.clear(); current_section.push_str(line); let _ = current_section.pop(); let _ = current_section.remove(0); diff --git a/tests/aead_tests.rs b/tests/aead_tests.rs index 8e1e4e81a1..263e647848 100644 --- a/tests/aead_tests.rs +++ b/tests/aead_tests.rs @@ -345,7 +345,7 @@ where let mut in_out = vec![123u8; 4096]; for &in_prefix_len in in_prefix_lengths.iter() { - in_out.truncate(0); + in_out.clear(); in_out.resize(in_prefix_len, 123); in_out.extend_from_slice(tc.ciphertext); in_out.extend_from_slice(tc.tag); diff --git a/tests/agreement_tests.rs b/tests/agreement_tests.rs index 2ec8425e91..b484ac5b64 100644 --- a/tests/agreement_tests.rs +++ b/tests/agreement_tests.rs @@ -38,7 +38,7 @@ fn agreement_traits() { test::compile_time_assert_sync::(); assert_eq!( - format!("{:?}", &private_key), + format!("{:?}", private_key), "EphemeralPrivateKey { algorithm: Algorithm { curve: P256 } }" ); diff --git a/tests/hmac_tests.rs b/tests/hmac_tests.rs index f009309178..64782e358c 100644 --- a/tests/hmac_tests.rs +++ b/tests/hmac_tests.rs @@ -104,8 +104,8 @@ fn hmac_test_case_inner( #[test] fn hmac_debug() { let key = hmac::Key::new(hmac::HMAC_SHA256, &[0; 32]); - assert_eq!("Key { algorithm: SHA256 }", format!("{:?}", &key)); + assert_eq!("Key { algorithm: SHA256 }", format!("{:?}", key)); let ctx = hmac::Context::with_key(&key); - assert_eq!("Context { algorithm: SHA256 }", format!("{:?}", &ctx)); + assert_eq!("Context { algorithm: SHA256 }", format!("{:?}", ctx)); }