Skip to content

Commit 5df1b8e

Browse files
committed
Fix some clippy
1 parent be5cf81 commit 5df1b8e

2 files changed

Lines changed: 4 additions & 19 deletions

File tree

examples/tree/interface/src/common.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
use core::mem::size_of;
2-
use error_codes::error;
32
use macros::{array_fields, constant_group, error_codes};
43
use pinocchio::{
54
account::{RuntimeAccount as RuntimeAccountHeader, MAX_PERMITTED_DATA_INCREASE},

examples/tree/src/program.rs

Lines changed: 4 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,7 @@ pub unsafe extern "C" fn entrypoint(input: *mut u8, instruction_data: *mut u8) -
188188
// ANCHOR_END: entrypoint-branching
189189

190190
// ANCHOR: insert-input-checks
191+
#[allow(unused_assignments)]
191192
#[inline(always)]
192193
unsafe fn insert(
193194
input: *mut u8,
@@ -204,7 +205,7 @@ unsafe fn insert(
204205
);
205206

206207
// Error if user has data.
207-
let user = user_account!(input);
208+
let _user = user_account!(input);
208209

209210
// Error if tree is duplicate.
210211
let tree = account_non_dup!(input, input_buffer::TREE_ACCOUNT_OFF, error::TREE_DUPLICATE);
@@ -742,7 +743,7 @@ unsafe fn remove(
742743
#[inline(always)]
743744
unsafe fn initialize(
744745
input: *mut u8,
745-
instruction_data: *mut u8,
746+
_instruction_data: *mut u8,
746747
instruction_data_len: u64,
747748
n_accounts: u64,
748749
) -> u64 {
@@ -755,7 +756,7 @@ unsafe fn initialize(
755756
);
756757

757758
// Error if user has data.
758-
let user = user_account!(input);
759+
let _user = user_account!(input);
759760

760761
// Error if tree is duplicate or has data.
761762
let tree = account_non_dup!(input, input_buffer::TREE_ACCOUNT_OFF, error::TREE_DUPLICATE);
@@ -898,21 +899,6 @@ unsafe fn direction(node: *const TreeNode) -> usize {
898899
(node == (*(*node).parent).child[tree::DIR_R]) as usize
899900
}
900901

901-
#[inline(always)]
902-
unsafe fn search(tree_header: *const TreeHeader, key: u16) -> *mut TreeNode {
903-
let mut node = (*tree_header).root;
904-
loop {
905-
if node.is_null() {
906-
break;
907-
}
908-
if (*node).key == key {
909-
break;
910-
}
911-
node = (*node).child[(key > (*node).key) as usize];
912-
}
913-
node
914-
}
915-
916902
/// Rotate the subtree rooted at `subtree` in the given direction, returning new root of subtree.
917903
#[inline(always)]
918904
unsafe fn rotate_subtree(

0 commit comments

Comments
 (0)