From 18662ccd70897660b5070f234eb56d1deeb0132b Mon Sep 17 00:00:00 2001 From: Jacinta Ferrant Date: Thu, 31 Oct 2024 10:00:04 -0700 Subject: [PATCH] Clippy fix signer and stackslib cli.rs Signed-off-by: Jacinta Ferrant --- stacks-signer/src/config.rs | 2 +- stacks-signer/src/main.rs | 6 +----- stacks-signer/src/monitoring/mod.rs | 3 +-- stacks-signer/src/v0/signer.rs | 2 +- stackslib/src/cli.rs | 4 +--- 5 files changed, 5 insertions(+), 12 deletions(-) diff --git a/stacks-signer/src/config.rs b/stacks-signer/src/config.rs index 6fc7c7b2dd..7dd9cc4fdf 100644 --- a/stacks-signer/src/config.rs +++ b/stacks-signer/src/config.rs @@ -335,7 +335,7 @@ Metrics endpoint: {metrics_endpoint} /// Get the chain ID for the network pub fn to_chain_id(&self) -> u32 { - self.chain_id.unwrap_or_else(|| match self.network { + self.chain_id.unwrap_or(match self.network { Network::Mainnet => CHAIN_ID_MAINNET, Network::Testnet | Network::Mocknet => CHAIN_ID_TESTNET, }) diff --git a/stacks-signer/src/main.rs b/stacks-signer/src/main.rs index a23918f6f8..eac60cc53f 100644 --- a/stacks-signer/src/main.rs +++ b/stacks-signer/src/main.rs @@ -157,11 +157,7 @@ fn handle_generate_stacking_signature( fn handle_check_config(args: RunSignerArgs) { let config = GlobalConfig::try_from(&args.config).unwrap(); - println!( - "Signer version: {}\nConfig: \n{}", - VERSION_STRING.to_string(), - config - ); + println!("Signer version: {}\nConfig: \n{}", *VERSION_STRING, config); } fn handle_generate_vote(args: GenerateVoteArgs, do_print: bool) -> MessageSignature { diff --git a/stacks-signer/src/monitoring/mod.rs b/stacks-signer/src/monitoring/mod.rs index 621886b9c0..4f6956051c 100644 --- a/stacks-signer/src/monitoring/mod.rs +++ b/stacks-signer/src/monitoring/mod.rs @@ -97,8 +97,7 @@ pub fn update_signer_nonce(nonce: u64) { #[allow(dead_code)] /// Remove the origin from the full path to avoid duplicate metrics for different origins fn remove_origin_from_path(full_path: &str, origin: &str) -> String { - let path = full_path.replace(origin, ""); - path + full_path.replace(origin, "") } /// Start a new RPC call timer. diff --git a/stacks-signer/src/v0/signer.rs b/stacks-signer/src/v0/signer.rs index fcda30a270..bcdcd2f7a0 100644 --- a/stacks-signer/src/v0/signer.rs +++ b/stacks-signer/src/v0/signer.rs @@ -191,7 +191,7 @@ impl SignerTrait for Signer { "block_height" => b.header.chain_length, "signer_sighash" => %b.header.signer_signature_hash(), ); - stacks_client.post_block_until_ok(self, &b); + stacks_client.post_block_until_ok(self, b); } SignerMessage::MockProposal(mock_proposal) => { let epoch = match stacks_client.get_node_epoch() { diff --git a/stackslib/src/cli.rs b/stackslib/src/cli.rs index 9ff6e55644..587daee787 100644 --- a/stackslib/src/cli.rs +++ b/stackslib/src/cli.rs @@ -528,8 +528,6 @@ fn replay_block( fn replay_block_nakamoto( sort_db: &mut SortitionDB, stacks_chain_state: &mut StacksChainState, - mut chainstate_tx: ChainstateTx, - clarity_instance: &mut ClarityInstance, block: &NakamotoBlock, block_size: u64, ) -> Result<(), ChainstateError> { @@ -785,7 +783,7 @@ fn replay_block_nakamoto( return Err(e); }; - let (receipt, clarity_commit, reward_set_data) = ok_opt.expect("FATAL: unreachable"); + let (receipt, _clarity_commit, _reward_set_data) = ok_opt.expect("FATAL: unreachable"); assert_eq!( receipt.header.anchored_header.block_hash(),