From 9f5491a56f6af1fa9b030f23d40150673a52aaa1 Mon Sep 17 00:00:00 2001 From: Mason Reed Date: Sun, 4 May 2025 20:51:33 -0400 Subject: [Rust] Misc clippy lints --- rust/src/headless.rs | 8 ++++---- rust/src/project/folder.rs | 7 ++----- rust/src/string.rs | 2 +- rust/src/type_archive.rs | 3 +-- 4 files changed, 8 insertions(+), 12 deletions(-) (limited to 'rust/src') diff --git a/rust/src/headless.rs b/rust/src/headless.rs index 7279a459..1e56321b 100644 --- a/rust/src/headless.rs +++ b/rust/src/headless.rs @@ -255,10 +255,10 @@ impl MainThreadHandler for HeadlessMainThreadSender { } fn is_enterprise_product() -> bool { - match crate::product().as_str() { - "Binary Ninja Enterprise Client" | "Binary Ninja Ultimate" => true, - _ => false, - } + matches!( + crate::product().as_str(), + "Binary Ninja Enterprise Client" | "Binary Ninja Ultimate" + ) } #[derive(Debug, PartialEq, Eq, Clone, Copy, Hash)] diff --git a/rust/src/project/folder.rs b/rust/src/project/folder.rs index 80416197..c7ec82e4 100644 --- a/rust/src/project/folder.rs +++ b/rust/src/project/folder.rs @@ -93,17 +93,14 @@ impl ProjectFolder { P: ProgressCallback, { let dest_raw = dest.to_cstr(); - - let success = unsafe { + unsafe { BNProjectFolderExport( self.handle.as_ptr(), dest_raw.as_ptr(), &mut progress as *mut P as *mut c_void, Some(P::cb_progress_callback), ) - }; - - success + } } } diff --git a/rust/src/string.rs b/rust/src/string.rs index 5be623c1..820418d0 100644 --- a/rust/src/string.rs +++ b/rust/src/string.rs @@ -189,7 +189,7 @@ pub unsafe trait AsCStr { fn to_cstr(self) -> Self::Result; } -unsafe impl<'a> AsCStr for &'a CStr { +unsafe impl AsCStr for &CStr { type Result = Self; fn to_cstr(self) -> Self::Result { diff --git a/rust/src/type_archive.rs b/rust/src/type_archive.rs index 05929561..8d9dd670 100644 --- a/rust/src/type_archive.rs +++ b/rust/src/type_archive.rs @@ -250,8 +250,7 @@ impl TypeArchive { /// Delete an existing type in the type archive. pub fn delete_type_by_id(&self, id: S) -> bool { let id = id.to_cstr(); - let result = unsafe { BNDeleteTypeArchiveType(self.handle.as_ptr(), id.as_ptr()) }; - result + unsafe { BNDeleteTypeArchiveType(self.handle.as_ptr(), id.as_ptr()) } } /// Retrieve a stored type in the archive -- cgit v1.3.1