Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix some clippy warnings #692

Merged
merged 3 commits into from
Jan 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/read/aranges.rs
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ where
.and_then(|x| x.checked_add(segment_size))
.ok_or(Error::InvalidAddressRange)?;
if tuple_length == 0 {
return Err(Error::InvalidAddressRange)?;
return Err(Error::InvalidAddressRange);
}
let padding = if header_length % tuple_length == 0 {
0
Expand Down
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/loc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,7 @@ mod convert {
// In some cases, existing data may contain begin == end, filtering
// these out.
match loc {
Location::StartLength { length, .. } if length == 0 => continue,
Location::StartLength { length: 0, .. } => continue,
Location::StartEnd { begin, end, .. } if begin == end => continue,
Location::OffsetPair { begin, end, .. } if begin == end => continue,
_ => (),
Expand Down
2 changes: 1 addition & 1 deletion src/write/range.rs
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ mod convert {
};
// Filtering empty ranges out.
match range {
Range::StartLength { length, .. } if length == 0 => continue,
Range::StartLength { length: 0, .. } => continue,
Range::StartEnd { begin, end, .. } if begin == end => continue,
Range::OffsetPair { begin, end, .. } if begin == end => continue,
_ => (),
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
Loading