Skip to content

Commit

Permalink
clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
A1-Triard committed May 25, 2024
1 parent ad21f02 commit 4229a82
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 10 deletions.
4 changes: 2 additions & 2 deletions src/bitflags_ext.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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, " ")?;
}
Expand Down
2 changes: 1 addition & 1 deletion src/code.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

Expand Down
2 changes: 1 addition & 1 deletion src/code/ser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ impl From<io::Error> for IoError {
const SIZE_STUB: u32 = 0x1375F17B;

fn size(len: usize) -> Result<u32, Error> {
if len > u32::max_value() as usize {
if len > u32::MAX as usize {
Err(Error::LargeObject(len))
} else {
Ok(len as u32)
Expand Down
8 changes: 4 additions & 4 deletions src/field.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::<i32, f32>(position.0) },
y: unsafe { transmute::<i32, f32>(position.1) },
}
} else {
CellPosition::Exterior {
Expand All @@ -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::<f32, i32>(x) },
unsafe { transmute::<f32, i32>(y) }
)
}
}
Expand Down
1 change: 1 addition & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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"]

Expand Down
4 changes: 2 additions & 2 deletions src/read.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::<i32, f32>(x) },
y: unsafe { transmute::<i32, f32>(y) }
}
} else {
CellPosition::Exterior { x, y }
Expand Down

0 comments on commit 4229a82

Please sign in to comment.