diff options
| author | KyleMiles <krm504@nyu.edu> | 2024-02-02 13:33:16 -0500 |
|---|---|---|
| committer | KyleMiles <krm504@nyu.edu> | 2024-02-02 13:33:16 -0500 |
| commit | 668f9cb0e0ea45c6d2cdc802dbe99b12f5623fff (patch) | |
| tree | 35bfa06ed37d60cbc45e2a26b6cb7c432f41c7fe /rust/src | |
| parent | f682ca69b356755fe6c06bcdd8f4fab73f7d2c78 (diff) | |
Rust API : Misc clippy fixes
Diffstat (limited to 'rust/src')
| -rw-r--r-- | rust/src/architecture.rs | 6 | ||||
| -rw-r--r-- | rust/src/linearview.rs | 6 | ||||
| -rw-r--r-- | rust/src/relocation.rs | 12 |
3 files changed, 12 insertions, 12 deletions
diff --git a/rust/src/architecture.rs b/rust/src/architecture.rs index f5aed09e..df34f1fe 100644 --- a/rust/src/architecture.rs +++ b/rust/src/architecture.rs @@ -997,7 +997,7 @@ impl Intrinsic for crate::architecture::CoreIntrinsic { let ret = slice::from_raw_parts_mut(inputs, count) .iter() - .map(|input| NameAndType::from_raw(input)) + .map(NameAndType::from_raw) .collect(); BNFreeNameAndTypeList(inputs, count); @@ -2405,7 +2405,7 @@ where unsafe { *count = res.len(); - if res.len() == 0 { + if res.is_empty() { ptr::null_mut() } else { let raw = res.as_mut_ptr(); @@ -2456,7 +2456,7 @@ where unsafe { *count = res.len(); - if res.len() == 0 { + if res.is_empty() { ptr::null_mut() } else { let raw = res.as_mut_ptr(); diff --git a/rust/src/linearview.rs b/rust/src/linearview.rs index 82094f6f..09968fc6 100644 --- a/rust/src/linearview.rs +++ b/rust/src/linearview.rs @@ -330,11 +330,7 @@ impl PartialEq for LinearViewCursor { impl PartialOrd for LinearViewCursor { fn partial_cmp(&self, other: &Self) -> Option<std::cmp::Ordering> { - match unsafe { BNCompareLinearViewCursors(self.handle, other.handle) } { - i if i < 0 => Some(std::cmp::Ordering::Less), - i if i > 0 => Some(std::cmp::Ordering::Greater), - _ => Some(std::cmp::Ordering::Equal), - } + Some(self.cmp(other)) } } diff --git a/rust/src/relocation.rs b/rust/src/relocation.rs index 7be7861d..f9cbb3c5 100644 --- a/rust/src/relocation.rs +++ b/rust/src/relocation.rs @@ -172,6 +172,12 @@ impl RelocationInfo { } } +impl Default for RelocationInfo { + fn default() -> Self { + Self::new() + } +} + pub struct Relocation(*mut BNRelocation); impl Relocation { @@ -430,7 +436,7 @@ where let result = unsafe { core::slice::from_raw_parts_mut(result, count) }; let mut info = result .iter() - .map(|i| RelocationInfo::from_raw(i)) + .map(RelocationInfo::from_raw) .collect::<Vec<_>>(); let ok = custom_handler.get_relocation_info(bv.as_ref(), arch.as_ref(), info.as_mut_slice()); @@ -549,9 +555,7 @@ where R: 'static + RelocationHandler<Handle = Self> + Send + Sync, { fn clone(&self) -> Self { - Self { - handle: self.handle, - } + *self } } |
