Skip to content

Commit

Permalink
Misc formatting and clippy lints
Browse files Browse the repository at this point in the history
  • Loading branch information
emesare committed Aug 24, 2024
1 parent 04d268c commit 35fe347
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 22 deletions.
3 changes: 1 addition & 2 deletions rust/examples/dwarf/dwarf_import/src/dwarfdebuginfo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -285,8 +285,7 @@ impl DebugInfoBuilder {

return Some(*idx);
}
}
else {
} else {
debug!("Function entry in DWARF without full or raw name.");
return None;
}
Expand Down
2 changes: 1 addition & 1 deletion rust/src/binaryview.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1371,7 +1371,7 @@ pub trait BinaryViewExt: BinaryViewBase {
let ranges = unsafe {
let mut count = 0;
let reloc_ranges_ptr = BNGetRelocationRanges(self.as_ref().handle, &mut count);
let ranges = std::slice::from_raw_parts(reloc_ranges_ptr, count).clone();
let ranges = std::slice::from_raw_parts(reloc_ranges_ptr, count);
BNFreeRelocationRanges(reloc_ranges_ptr);
ranges
};
Expand Down
24 changes: 6 additions & 18 deletions rust/src/callingconvention.rs
Original file line number Diff line number Diff line change
Expand Up @@ -305,11 +305,8 @@ where
C: CallingConventionBase,
{
ffi_wrap!("CallingConvention::incoming_reg_value", unsafe {
//let ctxt = &*(ctxt as *mut CustomCallingConventionContext<C>);
let val = &mut *val;

val.state = BNRegisterValueType::EntryValue;
val.value = _reg as i64;
(*val).state = BNRegisterValueType::EntryValue;
(*val).value = _reg as i64;
})
}

Expand All @@ -323,11 +320,8 @@ where
C: CallingConventionBase,
{
ffi_wrap!("CallingConvention::incoming_flag_value", unsafe {
//let ctxt = &*(ctxt as *mut CustomCallingConventionContext<C>);
let val = &mut *val;

val.state = BNRegisterValueType::EntryValue;
val.value = _flag as i64;
(*val).state = BNRegisterValueType::EntryValue;
(*val).value = _flag as i64;
})
}

Expand All @@ -341,10 +335,7 @@ where
{
ffi_wrap!("CallingConvention::incoming_var_for_param", unsafe {
let ctxt = &*(ctxt as *mut CustomCallingConventionContext<C>);
ptr::write(
param,
BNGetDefaultIncomingVariableForParameterVariable(ctxt.raw_handle, var),
);
*param = BNGetDefaultIncomingVariableForParameterVariable(ctxt.raw_handle, var);
})
}

Expand All @@ -358,10 +349,7 @@ where
{
ffi_wrap!("CallingConvention::incoming_param_for_var", unsafe {
let ctxt = &*(ctxt as *mut CustomCallingConventionContext<C>);
ptr::write(
param,
BNGetDefaultParameterVariableForIncomingVariable(ctxt.raw_handle, var),
);
*param = BNGetDefaultParameterVariableForIncomingVariable(ctxt.raw_handle, var);
})
}

Expand Down
4 changes: 3 additions & 1 deletion rust/src/enterprise.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ pub fn server_url() -> BnString {
pub fn set_server_url<S: BnStrCompatible>(url: S) -> Result<(), ()> {
let url = url.into_bytes_with_nul();
let result = unsafe {
binaryninjacore_sys::BNSetEnterpriseServerUrl(url.as_ref().as_ptr() as *const std::os::raw::c_char)
binaryninjacore_sys::BNSetEnterpriseServerUrl(
url.as_ref().as_ptr() as *const std::os::raw::c_char
)
};
if result {
Ok(())
Expand Down

0 comments on commit 35fe347

Please sign in to comment.