Skip to content

Commit d94b09c

Browse files
committed
Fix unused_unit clippy warnings in stackslib
Signed-off-by: Jacinta Ferrant <[email protected]>
1 parent 0ee5d7c commit d94b09c

File tree

36 files changed

+151
-157
lines changed

36 files changed

+151
-157
lines changed

stackslib/src/burnchains/bitcoin/spv.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -358,7 +358,7 @@ impl SpvClient {
358358
}
359359

360360
/// Get the block range to scan
361-
pub fn set_scan_range(&mut self, start_block: u64, end_block: Option<u64>) -> () {
361+
pub fn set_scan_range(&mut self, start_block: u64, end_block: Option<u64>) {
362362
self.start_block_height = start_block;
363363
self.end_block_height = end_block;
364364
self.cur_block_height = start_block;

stackslib/src/burnchains/db.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ impl FromRow<BlockCommitMetadata> for BlockCommitMetadata {
144144
pub(crate) fn apply_blockstack_txs_safety_checks(
145145
block_height: u64,
146146
blockstack_txs: &mut Vec<BlockstackOperationType>,
147-
) -> () {
147+
) {
148148
test_debug!(
149149
"Apply safety checks on {} txs at burnchain height {}",
150150
blockstack_txs.len(),

stackslib/src/burnchains/tests/mod.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -279,11 +279,11 @@ impl TestMiner {
279279
self.nonce
280280
}
281281

282-
pub fn set_nonce(&mut self, n: u64) -> () {
282+
pub fn set_nonce(&mut self, n: u64) {
283283
self.nonce = n;
284284
}
285285

286-
pub fn sign_as_origin(&mut self, tx_signer: &mut StacksTransactionSigner) -> () {
286+
pub fn sign_as_origin(&mut self, tx_signer: &mut StacksTransactionSigner) {
287287
let num_keys = if self.privks.len() < self.num_sigs as usize {
288288
self.privks.len()
289289
} else {
@@ -297,7 +297,7 @@ impl TestMiner {
297297
self.nonce += 1
298298
}
299299

300-
pub fn sign_as_sponsor(&mut self, tx_signer: &mut StacksTransactionSigner) -> () {
300+
pub fn sign_as_sponsor(&mut self, tx_signer: &mut StacksTransactionSigner) {
301301
let num_keys = if self.privks.len() < self.num_sigs as usize {
302302
self.privks.len()
303303
} else {
@@ -576,7 +576,7 @@ impl TestBurnchainBlock {
576576
)
577577
}
578578

579-
pub fn patch_from_chain_tip(&mut self, parent_snapshot: &BlockSnapshot) -> () {
579+
pub fn patch_from_chain_tip(&mut self, parent_snapshot: &BlockSnapshot) {
580580
assert_eq!(parent_snapshot.block_height + 1, self.block_height);
581581

582582
for i in 0..self.txs.len() {
@@ -734,7 +734,7 @@ impl TestBurnchainFork {
734734
new_fork
735735
}
736736

737-
pub fn append_block(&mut self, b: TestBurnchainBlock) -> () {
737+
pub fn append_block(&mut self, b: TestBurnchainBlock) {
738738
self.pending_blocks.push(b);
739739
}
740740

@@ -894,7 +894,7 @@ fn process_next_sortition(
894894
(tip_snapshot, next_prev_keys, next_commits)
895895
}
896896

897-
fn verify_keys_accepted(node: &mut TestBurnchainNode, prev_keys: &Vec<LeaderKeyRegisterOp>) -> () {
897+
fn verify_keys_accepted(node: &mut TestBurnchainNode, prev_keys: &Vec<LeaderKeyRegisterOp>) {
898898
// all keys accepted
899899
for key in prev_keys.iter() {
900900
let tx_opt = SortitionDB::get_burnchain_transaction(node.sortdb.conn(), &key.txid).unwrap();
@@ -915,7 +915,7 @@ fn verify_keys_accepted(node: &mut TestBurnchainNode, prev_keys: &Vec<LeaderKeyR
915915
fn verify_commits_accepted(
916916
node: &TestBurnchainNode,
917917
next_block_commits: &Vec<LeaderBlockCommitOp>,
918-
) -> () {
918+
) {
919919
// all commits accepted
920920
for commit in next_block_commits.iter() {
921921
let tx_opt =

stackslib/src/chainstate/burn/db/sortdb.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4120,8 +4120,8 @@ impl SortitionDB {
41204120
mut after: G,
41214121
) -> Result<(), BurnchainError>
41224122
where
4123-
F: FnMut(&mut SortitionDBTx, &BurnchainHeaderHash, &Vec<BurnchainHeaderHash>) -> (),
4124-
G: FnMut(&mut SortitionDBTx) -> (),
4123+
F: FnMut(&mut SortitionDBTx, &BurnchainHeaderHash, &Vec<BurnchainHeaderHash>),
4124+
G: FnMut(&mut SortitionDBTx),
41254125
{
41264126
let mut db_tx = self.tx_begin()?;
41274127
let mut queue = vec![burn_block.clone()];
@@ -4287,7 +4287,7 @@ impl SortitionDB {
42874287
/// * `next_pox_info` - iff this sortition is the first block in a reward cycle, this should be Some
42884288
/// * `announce_to` - a function that will be invoked with the calculated reward set before this method
42894289
/// commits its results. This is used to post the calculated reward set to an event observer.
4290-
pub fn evaluate_sortition<F: FnOnce(Option<RewardSetInfo>) -> ()>(
4290+
pub fn evaluate_sortition<F: FnOnce(Option<RewardSetInfo>)>(
42914291
&mut self,
42924292
mainnet: bool,
42934293
burn_header: &BurnchainBlockHeader,
@@ -5238,7 +5238,7 @@ impl SortitionDB {
52385238
pub fn merge_block_header_cache(
52395239
cache: &mut BlockHeaderCache,
52405240
header_data: &Vec<(ConsensusHash, Option<BlockHeaderHash>)>,
5241-
) -> () {
5241+
) {
52425242
if header_data.len() > 0 {
52435243
let mut i = header_data.len() - 1;
52445244
while i > 0 {

stackslib/src/chainstate/burn/distribution.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -365,7 +365,7 @@ impl BurnSamplePoint {
365365

366366
/// Calculate the ranges between 0 and 2**256 - 1 over which each point in the burn sample
367367
/// applies, so we can later select which block to use.
368-
fn make_sortition_ranges(burn_sample: &mut Vec<BurnSamplePoint>) -> () {
368+
fn make_sortition_ranges(burn_sample: &mut Vec<BurnSamplePoint>) {
369369
if burn_sample.len() == 0 {
370370
// empty sample
371371
return;

stackslib/src/chainstate/stacks/auth.rs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -207,12 +207,12 @@ impl MultisigSpendingCondition {
207207
&mut self,
208208
key_encoding: TransactionPublicKeyEncoding,
209209
signature: MessageSignature,
210-
) -> () {
210+
) {
211211
self.fields
212212
.push(TransactionAuthField::Signature(key_encoding, signature));
213213
}
214214

215-
pub fn push_public_key(&mut self, public_key: StacksPublicKey) -> () {
215+
pub fn push_public_key(&mut self, public_key: StacksPublicKey) {
216216
self.fields
217217
.push(TransactionAuthField::PublicKey(public_key));
218218
}
@@ -406,12 +406,12 @@ impl OrderIndependentMultisigSpendingCondition {
406406
&mut self,
407407
key_encoding: TransactionPublicKeyEncoding,
408408
signature: MessageSignature,
409-
) -> () {
409+
) {
410410
self.fields
411411
.push(TransactionAuthField::Signature(key_encoding, signature));
412412
}
413413

414-
pub fn push_public_key(&mut self, public_key: StacksPublicKey) -> () {
414+
pub fn push_public_key(&mut self, public_key: StacksPublicKey) {
415415
self.fields
416416
.push(TransactionAuthField::PublicKey(public_key));
417417
}
@@ -569,7 +569,7 @@ impl StacksMessageCodec for SinglesigSpendingCondition {
569569
}
570570

571571
impl SinglesigSpendingCondition {
572-
pub fn set_signature(&mut self, signature: MessageSignature) -> () {
572+
pub fn set_signature(&mut self, signature: MessageSignature) {
573573
self.signature = signature;
574574
}
575575

@@ -908,7 +908,7 @@ impl TransactionSpendingCondition {
908908
}
909909
}
910910

911-
pub fn set_nonce(&mut self, n: u64) -> () {
911+
pub fn set_nonce(&mut self, n: u64) {
912912
match *self {
913913
TransactionSpendingCondition::Singlesig(ref mut singlesig_data) => {
914914
singlesig_data.nonce = n;
@@ -922,7 +922,7 @@ impl TransactionSpendingCondition {
922922
}
923923
}
924924

925-
pub fn set_tx_fee(&mut self, tx_fee: u64) -> () {
925+
pub fn set_tx_fee(&mut self, tx_fee: u64) {
926926
match *self {
927927
TransactionSpendingCondition::Singlesig(ref mut singlesig_data) => {
928928
singlesig_data.tx_fee = tx_fee;
@@ -978,7 +978,7 @@ impl TransactionSpendingCondition {
978978
}
979979

980980
/// Clear fee rate, nonces, signatures, and public keys
981-
pub fn clear(&mut self) -> () {
981+
pub fn clear(&mut self) {
982982
match *self {
983983
TransactionSpendingCondition::Singlesig(ref mut singlesig_data) => {
984984
singlesig_data.tx_fee = 0;
@@ -1309,7 +1309,7 @@ impl TransactionAuth {
13091309
self.origin().nonce()
13101310
}
13111311

1312-
pub fn set_origin_nonce(&mut self, n: u64) -> () {
1312+
pub fn set_origin_nonce(&mut self, n: u64) {
13131313
match *self {
13141314
TransactionAuth::Standard(ref mut s) => s.set_nonce(n),
13151315
TransactionAuth::Sponsored(ref mut s, _) => s.set_nonce(n),
@@ -1340,7 +1340,7 @@ impl TransactionAuth {
13401340
}
13411341
}
13421342

1343-
pub fn set_tx_fee(&mut self, tx_fee: u64) -> () {
1343+
pub fn set_tx_fee(&mut self, tx_fee: u64) {
13441344
match *self {
13451345
TransactionAuth::Standard(ref mut s) => s.set_tx_fee(tx_fee),
13461346
TransactionAuth::Sponsored(_, ref mut s) => s.set_tx_fee(tx_fee),
@@ -1376,7 +1376,7 @@ impl TransactionAuth {
13761376
}
13771377

13781378
/// Clear out all transaction auth fields, nonces, and fee rates from the spending condition(s).
1379-
pub fn clear(&mut self) -> () {
1379+
pub fn clear(&mut self) {
13801380
match *self {
13811381
TransactionAuth::Standard(ref mut origin_condition) => {
13821382
origin_condition.clear();

stackslib/src/chainstate/stacks/db/blocks.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -678,7 +678,7 @@ impl StacksChainState {
678678
blocks_dir: &str,
679679
consensus_hash: &ConsensusHash,
680680
block_header_hash: &BlockHeaderHash,
681-
) -> () {
681+
) {
682682
let block_path =
683683
StacksChainState::make_block_dir(blocks_dir, consensus_hash, &block_header_hash)
684684
.expect("FATAL: failed to create block directory");
@@ -737,7 +737,7 @@ impl StacksChainState {
737737
blocks_path: &str,
738738
consensus_hash: &ConsensusHash,
739739
block_header: &StacksBlockHeader,
740-
) -> () {
740+
) {
741741
StacksChainState::free_block(blocks_path, consensus_hash, &block_header.block_hash())
742742
}
743743

@@ -7223,7 +7223,7 @@ pub mod test {
72237223
chainstate: &mut StacksChainState,
72247224
consensus_hash: &ConsensusHash,
72257225
block: &StacksBlock,
7226-
) -> () {
7226+
) {
72277227
assert!(StacksChainState::load_staging_block_data(
72287228
&chainstate.db(),
72297229
&chainstate.blocks_path,
@@ -7266,7 +7266,7 @@ pub mod test {
72667266
chainstate: &mut StacksChainState,
72677267
consensus_hash: &ConsensusHash,
72687268
block: &StacksBlock,
7269-
) -> () {
7269+
) {
72707270
assert!(!StacksChainState::has_stored_block(
72717271
&chainstate.db(),
72727272
&chainstate.blocks_path,
@@ -7290,7 +7290,7 @@ pub mod test {
72907290
chainstate: &mut StacksChainState,
72917291
consensus_hash: &ConsensusHash,
72927292
block: &StacksBlock,
7293-
) -> () {
7293+
) {
72947294
assert!(StacksChainState::has_stored_block(
72957295
&chainstate.db(),
72967296
&chainstate.blocks_path,
@@ -7351,7 +7351,7 @@ pub mod test {
73517351
chainstate: &mut StacksChainState,
73527352
consensus_hash: &ConsensusHash,
73537353
block: &StacksBlock,
7354-
) -> () {
7354+
) {
73557355
assert!(StacksChainState::has_stored_block(
73567356
&chainstate.db(),
73577357
&chainstate.blocks_path,

stackslib/src/chainstate/stacks/db/mod.rs

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -546,7 +546,7 @@ impl<'a, 'b> ClarityTx<'a, 'b> {
546546
}
547547

548548
#[cfg(test)]
549-
pub fn commit_block(self) -> () {
549+
pub fn commit_block(self) {
550550
self.block.commit_block();
551551
}
552552

@@ -557,11 +557,7 @@ impl<'a, 'b> ClarityTx<'a, 'b> {
557557
Ok(self.block.commit_mined_block(block_hash)?.get_total())
558558
}
559559

560-
pub fn commit_to_block(
561-
self,
562-
consensus_hash: &ConsensusHash,
563-
block_hash: &BlockHeaderHash,
564-
) -> () {
560+
pub fn commit_to_block(self, consensus_hash: &ConsensusHash, block_hash: &BlockHeaderHash) {
565561
let index_block_hash = StacksBlockHeader::make_index_block_hash(consensus_hash, block_hash);
566562
self.block.commit_to_block(&index_block_hash);
567563
}
@@ -575,19 +571,19 @@ impl<'a, 'b> ClarityTx<'a, 'b> {
575571
self.block.precommit_to_block(index_block_hash)
576572
}
577573

578-
pub fn commit_unconfirmed(self) -> () {
574+
pub fn commit_unconfirmed(self) {
579575
self.block.commit_unconfirmed();
580576
}
581577

582-
pub fn rollback_block(self) -> () {
578+
pub fn rollback_block(self) {
583579
self.block.rollback_block()
584580
}
585581

586-
pub fn rollback_unconfirmed(self) -> () {
582+
pub fn rollback_unconfirmed(self) {
587583
self.block.rollback_unconfirmed()
588584
}
589585

590-
pub fn reset_cost(&mut self, cost: ExecutionCost) -> () {
586+
pub fn reset_cost(&mut self, cost: ExecutionCost) {
591587
self.block.reset_block_cost(cost);
592588
}
593589

@@ -959,7 +955,7 @@ pub struct ChainStateBootData {
959955
pub first_burnchain_block_timestamp: u32,
960956
pub initial_balances: Vec<(PrincipalData, u64)>,
961957
pub pox_constants: PoxConstants,
962-
pub post_flight_callback: Option<Box<dyn FnOnce(&mut ClarityTx) -> ()>>,
958+
pub post_flight_callback: Option<Box<dyn FnOnce(&mut ClarityTx)>>,
963959
pub get_bulk_initial_lockups:
964960
Option<Box<dyn FnOnce() -> Box<dyn Iterator<Item = ChainstateAccountLockup>>>>,
965961
pub get_bulk_initial_balances:
@@ -974,7 +970,7 @@ impl ChainStateBootData {
974970
pub fn new(
975971
burnchain: &Burnchain,
976972
initial_balances: Vec<(PrincipalData, u64)>,
977-
post_flight_callback: Option<Box<dyn FnOnce(&mut ClarityTx) -> ()>>,
973+
post_flight_callback: Option<Box<dyn FnOnce(&mut ClarityTx)>>,
978974
) -> ChainStateBootData {
979975
ChainStateBootData {
980976
first_burnchain_block_hash: burnchain.first_block_hash.clone(),

stackslib/src/chainstate/stacks/index/marf.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -683,7 +683,7 @@ impl<T: MarfTrieId> MARF<T> {
683683
}
684684
}
685685

686-
fn node_copy_update_ptrs(ptrs: &mut [TriePtr], child_block_id: u32) -> () {
686+
fn node_copy_update_ptrs(ptrs: &mut [TriePtr], child_block_id: u32) {
687687
for pointer in ptrs.iter_mut() {
688688
// if the node is empty, do nothing, if it's a back pointer,
689689
if pointer.id() == TrieNodeID::Empty as u8 || is_backptr(pointer.id()) {

stackslib/src/chainstate/stacks/index/node.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -495,7 +495,7 @@ impl<T: MarfTrieId> TrieCursor<T> {
495495
/// Replace the last-visited node and ptr within this trie. Used when doing a copy-on-write or
496496
/// promoting a node, so the cursor state accurately reflects the nodes and tries visited.
497497
#[inline]
498-
pub fn repair_retarget(&mut self, node: &TrieNodeType, ptr: &TriePtr, hash: &T) -> () {
498+
pub fn repair_retarget(&mut self, node: &TrieNodeType, ptr: &TriePtr, hash: &T) {
499499
// this can only be called if we failed to walk to a node (this method _should not_ be
500500
// called if we walked to a backptr).
501501
if Some(CursorError::ChrNotFound) != self.last_error
@@ -526,7 +526,7 @@ impl<T: MarfTrieId> TrieCursor<T> {
526526
next_node: &TrieNodeType,
527527
ptr: &TriePtr,
528528
block_hash: T,
529-
) -> () {
529+
) {
530530
// this can only be called if we walked to a backptr.
531531
// If it's anything else, we're in trouble.
532532
if Some(CursorError::ChrNotFound) == self.last_error
@@ -553,7 +553,7 @@ impl<T: MarfTrieId> TrieCursor<T> {
553553
/// Record that we landed on a non-backptr from a backptr.
554554
/// ptr is a non-backptr that refers to the node we landed on.
555555
#[inline]
556-
pub fn repair_backptr_finish(&mut self, ptr: &TriePtr, block_hash: T) -> () {
556+
pub fn repair_backptr_finish(&mut self, ptr: &TriePtr, block_hash: T) {
557557
// this can only be called if we walked to a backptr.
558558
// If it's anything else, we're in trouble.
559559
if Some(CursorError::ChrNotFound) == self.last_error
@@ -1334,7 +1334,7 @@ impl TrieNodeType {
13341334
with_node!(self, ref data, &data.path)
13351335
}
13361336

1337-
pub fn set_path(&mut self, new_path: Vec<u8>) -> () {
1337+
pub fn set_path(&mut self, new_path: Vec<u8>) {
13381338
with_node!(self, ref mut data, data.path = new_path)
13391339
}
13401340
}

0 commit comments

Comments
 (0)