Skip to content

Commit ba766ff

Browse files
committed
Lower Rust level of crate & Applies clippy suggestions
1 parent 2b0d3cc commit ba766ff

File tree

3 files changed

+10
-11
lines changed

3 files changed

+10
-11
lines changed
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22
name = "example_data_renderer"
33
version = "0.1.0"
4-
edition = "2024"
4+
edition = "2021"
55

66
[lib]
77
crate-type = ["cdylib"]
@@ -10,4 +10,4 @@ crate-type = ["cdylib"]
1010
uuid = "1.18.1"
1111
binaryninjacore-sys = { path = "../../binaryninjacore-sys", default-features = false }
1212
binaryninja = { path = "../../" }
13-
log = "0.4.27"
13+
log = "0.4.27"

rust/examples/data_renderer/src/lib.rs

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,15 @@ use binaryninja::disassembly::{
66
DisassemblyTextLine, InstructionTextToken, InstructionTextTokenKind,
77
};
88
use binaryninja::types::{Type, TypeClass};
9-
use log::debug;
109
use uuid::Uuid;
1110

1211
struct UuidDataRenderer {}
1312

1413
impl CustomDataRenderer for UuidDataRenderer {
1514
fn is_valid_for_data(
1615
&self,
17-
view: &BinaryView,
18-
addr: u64,
16+
_view: &BinaryView,
17+
_addr: u64,
1918
type_: &Type,
2019
types: &[TypeContext],
2120
) -> bool {
@@ -61,11 +60,11 @@ impl CustomDataRenderer for UuidDataRenderer {
6160
&self,
6261
view: &BinaryView,
6362
addr: u64,
64-
type_: &Type,
63+
_type_: &Type,
6564
prefix: Vec<InstructionTextToken>,
66-
width: usize,
67-
types_ctx: &[TypeContext],
68-
language: &str,
65+
_width: usize,
66+
_types_ctx: &[TypeContext],
67+
_language: &str,
6968
) -> Vec<DisassemblyTextLine> {
7069
let mut tokens = prefix.clone();
7170

@@ -93,6 +92,8 @@ impl CustomDataRenderer for UuidDataRenderer {
9392
}
9493
}
9594

95+
/// # Safety
96+
/// This function is called from Binary Ninja once to initialize the plugin.
9697
#[allow(non_snake_case)]
9798
#[unsafe(no_mangle)]
9899
pub unsafe extern "C" fn CorePluginInit() -> bool {

rust/tests/data_renderer.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
use std::path::PathBuf;
2-
31
use binaryninja::binary_view::BinaryView;
42
use binaryninja::data_renderer::{
53
register_specific_data_renderer, CustomDataRenderer, TypeContext,

0 commit comments

Comments
 (0)