Skip to content

Commit 82cd67b

Browse files
committed
WARP: Run cargo fmt
1 parent 5239ad6 commit 82cd67b

File tree

5 files changed

+15
-14
lines changed

5 files changed

+15
-14
lines changed

plugins/warp/src/cache.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,9 @@ pub fn register_cache_destructor() {
2828
pub static mut CACHE_DESTRUCTOR: CacheDestructor = CacheDestructor;
2929
#[allow(static_mut_refs)]
3030
// SAFETY: This can be done as the backing data is an opaque ZST.
31-
unsafe { CACHE_DESTRUCTOR.register() };
31+
unsafe {
32+
CACHE_DESTRUCTOR.register()
33+
};
3234
}
3335

3436
pub fn cached_function_match<F>(function: &BNFunction, f: F) -> Option<Function>

plugins/warp/src/lib.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
use std::path::PathBuf;
21
use binaryninja::architecture::{
32
Architecture, ImplicitRegisterExtend, Register as BNRegister, RegisterInfo,
43
};
@@ -11,6 +10,7 @@ use binaryninja::llil::{
1110
VisitorAction,
1211
};
1312
use binaryninja::rc::Ref as BNRef;
13+
use std::path::PathBuf;
1414
use warp::signature::basic_block::BasicBlockGUID;
1515
use warp::signature::function::constraints::FunctionConstraints;
1616
use warp::signature::function::{Function, FunctionGUID};
@@ -31,10 +31,7 @@ pub fn core_signature_dir() -> PathBuf {
3131
let install_dir = binaryninja::install_directory().unwrap();
3232
// macOS core dir is separate from the install dir.
3333
#[cfg(target_os = "macos")]
34-
let core_dir = install_dir
35-
.parent()
36-
.unwrap()
37-
.join("Resources");
34+
let core_dir = install_dir.parent().unwrap().join("Resources");
3835
#[cfg(not(target_os = "macos"))]
3936
let core_dir = install_dir;
4037
core_dir.join("signatures")

plugins/warp/src/matcher.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ use crate::cache::{
2323
try_cached_function_guid,
2424
};
2525
use crate::convert::to_bn_type;
26-
use crate::{core_signature_dir, user_signature_dir};
2726
use crate::plugin::on_matched_function;
27+
use crate::{core_signature_dir, user_signature_dir};
2828

2929
pub static PLAT_MATCHER_CACHE: OnceLock<DashMap<PlatformID, Matcher>> = OnceLock::new();
3030

@@ -62,7 +62,7 @@ impl Matcher {
6262
/// Create a matcher from the platforms signature subdirectory.
6363
pub fn from_platform(platform: BNRef<Platform>) -> Self {
6464
let platform_name = platform.name().to_string();
65-
65+
6666
// Get core and user signatures.
6767
// TODO: Separate each file into own bucket for filtering?
6868
let plat_core_sig_dir = core_signature_dir().join(&platform_name);

plugins/warp/src/plugin/add.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
use crate::cache::{cached_function, cached_type_references};
22
use crate::matcher::invalidate_function_matcher_cache;
3+
use crate::user_signature_dir;
34
use binaryninja::binaryview::BinaryView;
45
use binaryninja::command::FunctionCommand;
56
use binaryninja::function::Function;
67
use std::io::Write;
78
use std::thread;
8-
use crate::user_signature_dir;
99

1010
pub struct AddFunctionSignature;
1111

@@ -20,14 +20,15 @@ impl FunctionCommand for AddFunctionSignature {
2020
log::error!("Could not get low level IL for function.");
2121
return;
2222
};
23-
23+
2424
// NOTE: Because we only can consume signatures from a specific directory, we don't need to use the interaction API.
2525
// If we did need to save signature files to a project than this would need to change.
2626
let Some(save_file) = rfd::FileDialog::new()
2727
.add_filter("Signature Files", &["sbin"])
2828
.set_file_name("user.sbin")
2929
.set_directory(signature_dir)
30-
.save_file() else {
30+
.save_file()
31+
else {
3132
return;
3233
};
3334

plugins/warp/src/plugin/create.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
use crate::cache::{cached_function, cached_type_references};
22
use crate::matcher::invalidate_function_matcher_cache;
3+
use crate::user_signature_dir;
34
use binaryninja::binaryview::{BinaryView, BinaryViewExt};
45
use binaryninja::command::Command;
56
use binaryninja::function::Function;
@@ -9,7 +10,6 @@ use std::sync::atomic::AtomicUsize;
910
use std::sync::atomic::Ordering::Relaxed;
1011
use std::thread;
1112
use std::time::Instant;
12-
use crate::user_signature_dir;
1313

1414
pub struct CreateSignatureFile;
1515

@@ -77,10 +77,11 @@ impl Command for CreateSignatureFile {
7777
.add_filter("Signature Files", &["sbin"])
7878
.set_file_name(format!("{}.sbin", view.file().filename().to_string()))
7979
.set_directory(signature_dir)
80-
.save_file() else {
80+
.save_file()
81+
else {
8182
return;
8283
};
83-
84+
8485
match std::fs::write(&save_file, data.to_bytes()) {
8586
Ok(_) => {
8687
log::info!("Signature file saved successfully.");

0 commit comments

Comments
 (0)