Skip to content

Commit

Permalink
Fix clippy::unnecessary_cast
Browse files Browse the repository at this point in the history
  • Loading branch information
Enselic committed Jan 30, 2024
1 parent 31078e0 commit e9ab4df
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/read/endian_reader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -393,8 +393,8 @@ where

#[inline]
fn offset_from(&self, base: &EndianReader<Endian, T>) -> usize {
let base_ptr = base.bytes().as_ptr() as *const u8 as usize;
let ptr = self.bytes().as_ptr() as *const u8 as usize;
let base_ptr = base.bytes().as_ptr() as usize;
let ptr = self.bytes().as_ptr() as usize;
debug_assert!(base_ptr <= ptr);
debug_assert!(ptr + self.bytes().len() <= base_ptr + base.bytes().len());
ptr - base_ptr
Expand Down
4 changes: 2 additions & 2 deletions src/read/endian_slice.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ where
/// of the given slice.
#[inline]
pub fn offset_from(&self, base: EndianSlice<'input, Endian>) -> usize {
let base_ptr = base.slice.as_ptr() as *const u8 as usize;
let ptr = self.slice.as_ptr() as *const u8 as usize;
let base_ptr = base.slice.as_ptr() as usize;
let ptr = self.slice.as_ptr() as usize;
debug_assert!(base_ptr <= ptr);
debug_assert!(ptr + self.slice.len() <= base_ptr + base.slice.len());
ptr - base_ptr
Expand Down
2 changes: 1 addition & 1 deletion src/read/value.rs
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ impl Value {
Value::I32(value) => value as u64,
Value::U32(value) => u64::from(value),
Value::I64(value) => value as u64,
Value::U64(value) => value as u64,
Value::U64(value) => value,
_ => return Err(Error::IntegralTypeRequired),
};
Ok(value)
Expand Down
2 changes: 1 addition & 1 deletion src/write/unit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1098,7 +1098,7 @@ impl AttributeValue {
}
AttributeValue::AddressClass(val) => {
debug_assert_form!(constants::DW_FORM_udata);
uleb128_size(val.0 as u64)
uleb128_size(val.0)
}
AttributeValue::IdentifierCase(val) => {
debug_assert_form!(constants::DW_FORM_udata);
Expand Down

0 comments on commit e9ab4df

Please sign in to comment.