From 4229a8255e09bccd31ead6ae25634fb583d4a9d5 Mon Sep 17 00:00:00 2001 From: Warlock Date: Sat, 25 May 2024 22:17:15 +0300 Subject: [PATCH] clippy --- src/bitflags_ext.rs | 4 ++-- src/code.rs | 2 +- src/code/ser.rs | 2 +- src/field.rs | 8 ++++---- src/lib.rs | 1 + src/read.rs | 4 ++-- 6 files changed, 11 insertions(+), 10 deletions(-) diff --git a/src/bitflags_ext.rs b/src/bitflags_ext.rs index 9baa1f6..e34b804 100644 --- a/src/bitflags_ext.rs +++ b/src/bitflags_ext.rs @@ -38,8 +38,8 @@ macro_rules! bitflags_ext { $( if self.contains($flags::$name) { if start { - #[allow(unused_assignments)] - start = false; + (#[allow(unused_assignments)] + start) = false; } else { write!(f, " ")?; } diff --git a/src/code.rs b/src/code.rs index b388659..6492db7 100644 --- a/src/code.rs +++ b/src/code.rs @@ -62,7 +62,7 @@ pub fn deserialize_seed<'de, T: DeserializeSeed<'de>>(seed: T, mut bytes: &'de [ } fn bytes_deserializer<'a, 'de>(bytes: &'a mut &'de [u8], isolated: bool) -> EslDeserializer<'static, 'a, 'de, &'de [u8]> { - assert!(!isolated || bytes.len() <= u32::max_value() as usize); + assert!(!isolated || bytes.len() <= u32::MAX as usize); EslDeserializer::new(if isolated { Some(bytes.len() as u32) } else { None }, bytes) } diff --git a/src/code/ser.rs b/src/code/ser.rs index f47b0ee..2dce906 100644 --- a/src/code/ser.rs +++ b/src/code/ser.rs @@ -76,7 +76,7 @@ impl From for IoError { const SIZE_STUB: u32 = 0x1375F17B; fn size(len: usize) -> Result { - if len > u32::max_value() as usize { + if len > u32::MAX as usize { Err(Error::LargeObject(len)) } else { Ok(len as u32) diff --git a/src/field.rs b/src/field.rs index e5eeab2..1af75eb 100644 --- a/src/field.rs +++ b/src/field.rs @@ -3231,8 +3231,8 @@ impl CellPosition { fn from_exterior(is_interior: bool, position: (i32, i32)) -> Self { if is_interior { CellPosition::Interior { - x: unsafe { transmute(position.0) }, - y: unsafe { transmute(position.1) }, + x: unsafe { transmute::(position.0) }, + y: unsafe { transmute::(position.1) }, } } else { CellPosition::Exterior { @@ -3246,8 +3246,8 @@ impl CellPosition { match self { &CellPosition::Exterior { x, y } => (x, y), &CellPosition::Interior { x, y } => ( - unsafe { transmute(x) }, - unsafe { transmute(y) } + unsafe { transmute::(x) }, + unsafe { transmute::(y) } ) } } diff --git a/src/lib.rs b/src/lib.rs index 2f2e661..87a01bb 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -19,6 +19,7 @@ #![allow(clippy::match_ref_pats)] #![allow(clippy::transmute_float_to_int)] #![allow(clippy::transmute_int_to_float)] +#![allow(clippy::needless_doctest_main)] #![recursion_limit="512"] diff --git a/src/read.rs b/src/read.rs index 3c1efb2..73ce2b0 100644 --- a/src/read.rs +++ b/src/read.rs @@ -697,8 +697,8 @@ fn cell_field(input: &[u8]) -> IResult<&[u8], Cell, FieldBodyError> { |(flags, (x, y))| { let position = if flags.contains(CellFlags::INTERIOR) { CellPosition::Interior { - x: unsafe { transmute(x) }, - y: unsafe { transmute(y) } + x: unsafe { transmute::(x) }, + y: unsafe { transmute::(y) } } } else { CellPosition::Exterior { x, y }