From 33eb8129f5f95f379bff6a5ba90b5a298c8318d6 Mon Sep 17 00:00:00 2001 From: Mason Reed Date: Thu, 7 Nov 2024 17:06:43 -0500 Subject: WARP: Misc clippy lints --- plugins/warp/src/bin/sigem.rs | 2 +- plugins/warp/src/matcher.rs | 21 ++++++++++----------- plugins/warp/src/plugin/find.rs | 2 +- 3 files changed, 12 insertions(+), 13 deletions(-) (limited to 'plugins') diff --git a/plugins/warp/src/bin/sigem.rs b/plugins/warp/src/bin/sigem.rs index 322096ee..63c9a677 100644 --- a/plugins/warp/src/bin/sigem.rs +++ b/plugins/warp/src/bin/sigem.rs @@ -96,7 +96,7 @@ fn data_from_view(view: &BinaryView) -> Data { .collect::>(); data.types.extend(view.types().iter().map(|ty| { let ref_ty = ty.type_object().to_owned(); - ComputedType::new(from_bn_type(&view, &ref_ty, u8::MAX)) + ComputedType::new(from_bn_type(view, &ref_ty, u8::MAX)) })); data } diff --git a/plugins/warp/src/matcher.rs b/plugins/warp/src/matcher.rs index 72751c4c..d5ecfbb7 100644 --- a/plugins/warp/src/matcher.rs +++ b/plugins/warp/src/matcher.rs @@ -1,5 +1,4 @@ use binaryninja::architecture::Architecture as BNArchitecture; -use binaryninja::backgroundtask::BackgroundTask; use binaryninja::binaryview::{BinaryView, BinaryViewExt}; use binaryninja::function::Function as BNFunction; use binaryninja::platform::Platform; @@ -82,13 +81,13 @@ impl Matcher { } pub fn from_data(data: Data) -> Self { - let functions = data - .functions - .into_iter() - .fold(DashMap::new(), |map, func| { - map.entry(func.guid).or_insert_with(Vec::new).push(func); + let functions = data.functions.into_iter().fold( + DashMap::new(), + |map: DashMap>, func| { + map.entry(func.guid).or_default().push(func); map - }); + }, + ); let types = data .types .iter() @@ -109,9 +108,9 @@ impl Matcher { } pub fn extend_with_matcher(&mut self, matcher: Matcher) { - self.functions.extend(matcher.functions.into_iter()); - self.types.extend(matcher.types.into_iter()); - self.named_types.extend(matcher.named_types.into_iter()); + self.functions.extend(matcher.functions); + self.types.extend(matcher.types); + self.named_types.extend(matcher.named_types); } pub fn add_type_to_view(&self, view: &BinaryView, arch: &A, ty: &Type) { @@ -368,7 +367,7 @@ impl MatcherSettings { ); } - pub fn from_view(view: &BinaryView) -> Self { + pub fn from_view(_view: &BinaryView) -> Self { let mut settings = MatcherSettings::default(); let bn_settings = binaryninja::settings::Settings::new(""); if bn_settings.contains(Self::TRIVIAL_FUNCTION_LEN_SETTING) { diff --git a/plugins/warp/src/plugin/find.rs b/plugins/warp/src/plugin/find.rs index 15a06add..f54b4a4c 100644 --- a/plugins/warp/src/plugin/find.rs +++ b/plugins/warp/src/plugin/find.rs @@ -36,7 +36,7 @@ impl Command for FindFunctionFromGUID { let matched = funcs .par_iter() .filter(|func| { - try_cached_function_guid(&func).is_some_and(|guid| guid == searched_guid) + try_cached_function_guid(func).is_some_and(|guid| guid == searched_guid) }) .collect::>>(); -- cgit v1.3.1