diff --git a/src/config.rs b/src/config.rs index 8f3334e8..684b3345 100644 --- a/src/config.rs +++ b/src/config.rs @@ -96,8 +96,7 @@ impl Configuration { /// 2. If `251 <= u < 2**16`, encode it as a literal byte 251, followed by a u16 with value `u`. /// 3. If `2**16 <= u < 2**32`, encode it as a literal byte 252, followed by a u32 with value `u`. /// 4. If `2**32 <= u < 2**64`, encode it as a literal byte 253, followed by a u64 with value `u`. - /// 5. If `2**64 <= u < 2**128`, encode it as a literal byte 254, followed by a - /// u128 with value `u`. + /// 5. If `2**64 <= u < 2**128`, encode it as a literal byte 254, followed by a u128 with value `u`. /// /// Then, for signed integers, we first convert to unsigned using the zigzag algorithm, /// and then encode them as we do for unsigned integers generally. The reason we use this diff --git a/src/features/impl_alloc.rs b/src/features/impl_alloc.rs index 3084eae0..d4e656ee 100644 --- a/src/features/impl_alloc.rs +++ b/src/features/impl_alloc.rs @@ -261,7 +261,7 @@ where let mut vec = alloc::vec![0u8; len]; decoder.reader().read(&mut vec)?; // Safety: Vec is Vec - Ok(unsafe { core::mem::transmute(vec) }) + Ok(unsafe { core::mem::transmute::, Vec>(vec) }) } else { decoder.claim_container_read::(len)?; @@ -290,7 +290,7 @@ where let mut vec = alloc::vec![0u8; len]; decoder.reader().read(&mut vec)?; // Safety: Vec is Vec - Ok(unsafe { core::mem::transmute(vec) }) + Ok(unsafe { core::mem::transmute::, Vec>(vec) }) } else { decoder.claim_container_read::(len)?; diff --git a/src/varint/decode_unsigned.rs b/src/varint/decode_unsigned.rs index de0f0b95..d6ab1e0c 100644 --- a/src/varint/decode_unsigned.rs +++ b/src/varint/decode_unsigned.rs @@ -1,4 +1,4 @@ -use core::{convert::TryInto, u32}; +use core::convert::TryInto; use super::{SINGLE_BYTE_MAX, U128_BYTE, U16_BYTE, U32_BYTE, U64_BYTE}; use crate::{ diff --git a/tests/alloc.rs b/tests/alloc.rs index 08c07bb0..73e153c3 100644 --- a/tests/alloc.rs +++ b/tests/alloc.rs @@ -138,9 +138,9 @@ fn test_container_limits() { let test_cases = &[ // u64::max_value(), should overflow #[cfg(target_pointer_width = "64")] - bincode::encode_to_vec(u64::max_value(), bincode::config::standard()).unwrap(), + bincode::encode_to_vec(u64::MAX, bincode::config::standard()).unwrap(), #[cfg(target_pointer_width = "32")] - bincode::encode_to_vec(u32::max_value(), bincode::config::standard()).unwrap(), + bincode::encode_to_vec(u32::MAX, bincode::config::standard()).unwrap(), // A high value which doesn't overflow, but exceeds the decode limit bincode::encode_to_vec(DECODE_LIMIT as u64, bincode::config::standard()).unwrap(), ];