Skip to content

Commit 5d9cd50

Browse files
committed
rust: Silence new lints
Clippy is incorrectly detecting needless borrows, that are in fact necessary to avoid use-after-moves.
1 parent 16ab6e8 commit 5d9cd50

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

src/rust/src/incremental_merkle_tree.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ pub fn read_auth_fragment_v1<H: HashSer, R: Read>(
2828
Ok((position, alts_observed, values))
2929
}
3030

31+
#[allow(clippy::needless_borrows_for_generic_args)]
3132
pub fn read_bridge_v1<H: HashSer + Ord + Clone, R: Read>(
3233
mut reader: R,
3334
) -> io::Result<MerkleBridge<H>> {
@@ -93,6 +94,7 @@ pub fn read_bridge_v1<H: HashSer + Ord + Clone, R: Read>(
9394
))
9495
}
9596

97+
#[allow(clippy::needless_borrows_for_generic_args)]
9698
pub fn read_bridge_v2<H: HashSer + Ord + Clone, R: Read>(
9799
mut reader: R,
98100
) -> io::Result<MerkleBridge<H>> {
@@ -138,6 +140,7 @@ pub fn read_bridge<H: HashSer + Ord + Clone, R: Read>(
138140
}
139141
}
140142

143+
#[allow(clippy::needless_borrows_for_generic_args)]
141144
pub fn write_bridge_v2<H: HashSer + Ord, W: Write>(
142145
mut writer: W,
143146
bridge: &MerkleBridge<H>,
@@ -181,6 +184,7 @@ pub fn write_bridge<H: HashSer + Ord, W: Write>(
181184
/// ordinary circumstances, the checkpoint ID will be the block height at which the checkpoint was
182185
/// created, but since we don't have any source for this information, we require the caller to
183186
/// provide it; any unique identifier will do so long as the identifiers are ordered correctly.
187+
#[allow(clippy::needless_borrows_for_generic_args)]
184188
pub fn read_checkpoint_v2<R: Read>(
185189
mut reader: R,
186190
checkpoint_id: u32,
@@ -248,6 +252,7 @@ pub fn write_checkpoint_v3<W: Write>(
248252
/// such data the returned identifiers will *not* correspond to block heights. As such, checkpoint
249253
/// ids should always be treated as opaque, totally ordered identifiers without additional
250254
/// semantics.
255+
#[allow(clippy::needless_borrows_for_generic_args)]
251256
#[allow(clippy::redundant_closure)]
252257
pub fn read_tree<H: Hashable + HashSer + Ord + Clone, const DEPTH: u8, R: Read>(
253258
mut reader: R,
@@ -306,6 +311,7 @@ pub fn read_tree<H: Hashable + HashSer + Ord + Clone, const DEPTH: u8, R: Read>(
306311
})
307312
}
308313

314+
#[allow(clippy::needless_borrows_for_generic_args)]
309315
pub fn write_tree<H: Hashable + HashSer + Ord, const DEPTH: u8, W: Write>(
310316
mut writer: W,
311317
tree: &BridgeTree<H, u32, DEPTH>,

src/rust/src/wallet.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1259,6 +1259,7 @@ pub extern "C" fn orchard_wallet_gc_note_commitment_tree(wallet: *mut Wallet) {
12591259

12601260
const NOTE_STATE_V1: u8 = 1;
12611261

1262+
#[allow(clippy::needless_borrows_for_generic_args)]
12621263
#[no_mangle]
12631264
pub extern "C" fn orchard_wallet_write_note_commitment_tree(
12641265
wallet: *const Wallet,
@@ -1307,6 +1308,7 @@ pub extern "C" fn orchard_wallet_write_note_commitment_tree(
13071308
}
13081309
}
13091310

1311+
#[allow(clippy::needless_borrows_for_generic_args)]
13101312
#[no_mangle]
13111313
pub extern "C" fn orchard_wallet_load_note_commitment_tree(
13121314
wallet: *mut Wallet,

0 commit comments

Comments
 (0)