summaryrefslogtreecommitdiff
path: root/rust/src
diff options
context:
space:
mode:
authorKyleMiles <krm504@nyu.edu>2024-05-10 12:05:45 -0400
committerKyleMiles <krm504@nyu.edu>2024-05-10 12:05:45 -0400
commit0ace079eb70b0c999914a1e95a3eb1324a3b19d8 (patch)
treef87d9f7a3e510f153a3fbbbe58160d13cd2c51ad /rust/src
parentadde27cfa50f7ef70821cecb71967d538962f7b3 (diff)
Rust API : Misc cargo clippy fixes
Diffstat (limited to 'rust/src')
-rw-r--r--rust/src/architecture.rs4
-rw-r--r--rust/src/filemetadata.rs4
-rw-r--r--rust/src/function.rs4
-rw-r--r--rust/src/metadata.rs2
4 files changed, 7 insertions, 7 deletions
diff --git a/rust/src/architecture.rs b/rust/src/architecture.rs
index 9aee0b16..713e8bf1 100644
--- a/rust/src/architecture.rs
+++ b/rust/src/architecture.rs
@@ -2442,7 +2442,7 @@ where
if !nt.is_null() {
unsafe {
let name_and_types = Box::from_raw(ptr::slice_from_raw_parts_mut(nt, count));
- for nt in name_and_types.into_iter() {
+ for nt in name_and_types.iter() {
Ref::new(NameAndType::from_raw(nt));
}
}
@@ -2674,7 +2674,7 @@ where
let raw = Box::into_raw(Box::new(uninit_arch));
let mut custom_arch = BNCustomArchitecture {
- context: raw as *mut ArchitectureBuilder<_, _> as *mut _,
+ context: raw as *mut _,
init: Some(cb_init::<A, F>),
getEndianness: Some(cb_endianness::<A>),
getAddressSize: Some(cb_address_size::<A>),
diff --git a/rust/src/filemetadata.rs b/rust/src/filemetadata.rs
index 3de14a9f..0ef427c4 100644
--- a/rust/src/filemetadata.rs
+++ b/rust/src/filemetadata.rs
@@ -222,7 +222,7 @@ impl FileMetadata {
BNCreateDatabaseWithProgress(
handle,
filename_ptr,
- core::mem::transmute(func),
+ func as *mut libc::c_void,
Some(cb_progress_func),
ptr::null_mut(),
)
@@ -271,7 +271,7 @@ impl FileMetadata {
BNOpenExistingDatabaseWithProgress(
self.handle,
filename_ptr,
- core::mem::transmute(func),
+ func as *mut libc::c_void,
Some(cb_progress_func),
)
},
diff --git a/rust/src/function.rs b/rust/src/function.rs
index f57d2fe3..04be898f 100644
--- a/rust/src/function.rs
+++ b/rust/src/function.rs
@@ -321,8 +321,8 @@ impl Function {
let confidence = variables.confidence;
let vars = std::slice::from_raw_parts(variables.vars, variables.count);
- for i in 0..variables.count {
- result.push(Variable::from_raw(vars[i]));
+ for var in vars.iter().take(variables.count) {
+ result.push(Variable::from_raw(*var));
}
BNFreeParameterVariables(&mut variables);
diff --git a/rust/src/metadata.rs b/rust/src/metadata.rs
index 8cb32d72..c8c532f3 100644
--- a/rust/src/metadata.rs
+++ b/rust/src/metadata.rs
@@ -456,7 +456,7 @@ where
{
fn from(value: &[(S, T)]) -> Self {
let data: Vec<(S::Result, Ref<Metadata>)> = value
- .into_iter()
+ .iter()
.map(|(k, v)| (k.into_bytes_with_nul(), v.into()))
.collect();
let mut keys: Vec<*const c_char> = data