summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKyleMiles <krm504@nyu.edu>2024-07-09 19:02:01 -0400
committerKyleMiles <krm504@nyu.edu>2024-07-09 19:02:01 -0400
commit6b72382e355807b7b309bbc21d18dc8defd12cec (patch)
tree03d57f6850c76034f107e4efbcb7b37326fc207b
parent1b22f189fc4b26fb383179f378b6d811e7c16083 (diff)
Rust API : Fix misc clippy warnings
-rw-r--r--rust/binaryninjacore-sys/build.rs4
-rw-r--r--rust/src/binaryview.rs8
-rw-r--r--rust/src/component.rs1
-rw-r--r--rust/src/debuginfo.rs6
-rw-r--r--rust/src/project.rs2
5 files changed, 11 insertions, 10 deletions
diff --git a/rust/binaryninjacore-sys/build.rs b/rust/binaryninjacore-sys/build.rs
index 9764662e..00abcfd3 100644
--- a/rust/binaryninjacore-sys/build.rs
+++ b/rust/binaryninjacore-sys/build.rs
@@ -83,9 +83,9 @@ fn main() {
for line in BufReader::new(file).lines() {
let line = line.unwrap();
if let Some(version) = line.strip_prefix(current_line) {
- current_version = version.to_owned();
+ version.clone_into(&mut current_version);
} else if let Some(version) = line.strip_prefix(minimum_line) {
- minimum_version = version.to_owned();
+ version.clone_into(&mut minimum_version);
}
}
diff --git a/rust/src/binaryview.rs b/rust/src/binaryview.rs
index 83249309..b8bac14a 100644
--- a/rust/src/binaryview.rs
+++ b/rust/src/binaryview.rs
@@ -1528,9 +1528,9 @@ pub trait BinaryViewExt: BinaryViewBase {
/// Recursively imports a type interface given its GUID.
///
/// .. note:: To support this type of lookup a type library must have
- /// contain a metadata key called "type_guids" which is a map
- /// Dict[string_guid, string_type_name] or
- /// Dict[string_guid, Tuple[string_type_name, type_library_name]]
+ /// contain a metadata key called "type_guids" which is a map
+ /// Dict[string_guid, string_type_name] or
+ /// Dict[string_guid, Tuple[string_type_name, type_library_name]]
fn import_type_by_guid<S: BnStrCompatible>(&self, guid: S) -> Option<Ref<Type>> {
let guid = guid.into_bytes_with_nul();
let result = unsafe {
@@ -1560,7 +1560,7 @@ pub trait BinaryViewExt: BinaryViewBase {
/// Recursively exports `type_obj` into `lib` as a type with name `name`
///
/// As other referenced types are encountered, they are either copied into the destination type library or
- /// else the type library that provided the referenced type is added as a dependency for the destination library.
+ /// else the type library that provided the referenced type is added as a dependency for the destination library.
fn export_object_to_library(&self, lib: &TypeLibrary, name: &QualifiedName, type_obj: &Type) {
unsafe {
BNBinaryViewExportObjectToTypeLibrary(
diff --git a/rust/src/component.rs b/rust/src/component.rs
index d28a1661..ec235043 100644
--- a/rust/src/component.rs
+++ b/rust/src/component.rs
@@ -240,6 +240,7 @@ impl PartialEq for Component {
unsafe { BNComponentsEqual(self.as_raw(), other.as_raw()) }
}
+ #[allow(clippy::partialeq_ne_impl)]
fn ne(&self, other: &Self) -> bool {
unsafe { BNComponentsNotEqual(self.as_raw(), other.as_raw()) }
}
diff --git a/rust/src/debuginfo.rs b/rust/src/debuginfo.rs
index 68c666e8..2b43c9cc 100644
--- a/rust/src/debuginfo.rs
+++ b/rust/src/debuginfo.rs
@@ -342,6 +342,7 @@ impl From<&BNDebugFunctionInfo> for DebugFunctionInfo {
}
impl DebugFunctionInfo {
+ #[allow(clippy::too_many_arguments)]
pub fn new(
short_name: Option<String>,
full_name: Option<String>,
@@ -357,10 +358,7 @@ impl DebugFunctionInfo {
full_name,
raw_name,
type_,
- address: match address {
- Some(address) => address,
- _ => 0,
- },
+ address: address.unwrap_or(0),
platform,
components,
local_variables,
diff --git a/rust/src/project.rs b/rust/src/project.rs
index beb0f008..a94b42e1 100644
--- a/rust/src/project.rs
+++ b/rust/src/project.rs
@@ -493,6 +493,7 @@ impl Project {
/// * `id` - id unique ID
/// * `creation_time` - Creation time of the file
/// * `progress_func` - Progress function that will be called as the file is being added
+ #[allow(clippy::too_many_arguments)]
pub unsafe fn create_file_from_path_with_progress_unsafe<P, N, D, I, F>(
&self,
path: P,
@@ -654,6 +655,7 @@ impl Project {
/// * `id` - id unique ID
/// * `creation_time` - Creation time of the file
/// * `progress_func` - Progress function that will be called as the file is being added
+ #[allow(clippy::too_many_arguments)]
pub unsafe fn create_file_with_progress_unsafe<N, D, I, F>(
&self,
contents: &[u8],