fix(clippy): Fix nightly clippy redundant code lints (#5916)

* Remove needless borrows

* Remove redundant into_iter()

* Remove unnecessary clone()
This commit is contained in:
teor 2023-01-06 01:46:04 +10:00 committed by GitHub
parent f3f8254e4a
commit 2f23de80f1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 15 additions and 17 deletions

View File

@ -737,7 +737,6 @@ where
let upgrade = request.upgrade(network);
let script_checks = (0..inputs.len())
.into_iter()
.map(move |input_index| {
let request = script::Request {
upgrade,

View File

@ -260,7 +260,7 @@ impl ChainTipSender {
span.record(
"old_use_non_finalized_tip",
&field::debug(self.use_non_finalized_tip),
field::debug(self.use_non_finalized_tip),
);
}
@ -271,8 +271,8 @@ impl ChainTipSender {
let height = tip.as_ref().map(|block| block.height);
let hash = tip.as_ref().map(|block| block.hash);
span.record(format!("{prefix}_height").as_str(), &field::debug(height));
span.record(format!("{prefix}_hash").as_str(), &field::debug(hash));
span.record(format!("{prefix}_height").as_str(), field::debug(height));
span.record(format!("{prefix}_hash").as_str(), field::debug(hash));
}
}
@ -330,23 +330,23 @@ impl LatestChainTip {
let register_span_fields = |chain_tip_block: Option<&ChainTipBlock>| {
span.record(
"height",
&tracing::field::debug(chain_tip_block.map(|block| block.height)),
tracing::field::debug(chain_tip_block.map(|block| block.height)),
);
span.record(
"hash",
&tracing::field::debug(chain_tip_block.map(|block| block.hash)),
tracing::field::debug(chain_tip_block.map(|block| block.hash)),
);
span.record(
"time",
&tracing::field::debug(chain_tip_block.map(|block| block.time)),
tracing::field::debug(chain_tip_block.map(|block| block.time)),
);
span.record(
"previous_hash",
&tracing::field::debug(chain_tip_block.map(|block| block.previous_block_hash)),
tracing::field::debug(chain_tip_block.map(|block| block.previous_block_hash)),
);
span.record(
"transaction_count",
&tracing::field::debug(chain_tip_block.map(|block| block.transaction_hashes.len())),
tracing::field::debug(chain_tip_block.map(|block| block.transaction_hashes.len())),
);
};

View File

@ -327,7 +327,7 @@ where
// TODO: implement Step for Height, when Step stabilises
// https://github.com/rust-lang/rust/issues/42168
let height_range = start_height.0..=final_height.0;
let response_len = height_range.clone().into_iter().count();
let response_len = height_range.clone().count();
tracing::debug!(
?start_height,

View File

@ -232,7 +232,7 @@ impl Service<zn::Request> for Inbound {
let block_downloads = Box::pin(BlockDownloads::new(
full_verify_concurrency_limit,
Timeout::new(block_download_peer_set.clone(), BLOCK_DOWNLOAD_TIMEOUT),
Timeout::new(block_download_peer_set, BLOCK_DOWNLOAD_TIMEOUT),
Timeout::new(block_verifier, BLOCK_VERIFY_TIMEOUT),
state.clone(),
latest_chain_tip,

View File

@ -135,8 +135,7 @@ fn mempool_storage_basic_for_network(network: Network) -> Result<()> {
.collect();
// Convert response to a `HashSet`, because the order of the response doesn't matter.
let all_rejected_ids: HashSet<UnminedTxId> =
storage.rejected_transactions(all_ids).into_iter().collect();
let all_rejected_ids: HashSet<UnminedTxId> = storage.rejected_transactions(all_ids).collect();
let some_rejected_ids = some_rejected_transactions
.iter()

View File

@ -1638,7 +1638,7 @@ fn lightwalletd_integration_test(test_type: TestType) -> Result<()> {
?zebra_rpc_address,
"waiting for zebrad to open its RPC port..."
);
zebrad.expect_stdout_line_matches(&format!(
zebrad.expect_stdout_line_matches(format!(
"Opened RPC endpoint at {}",
zebra_rpc_address.expect("lightwalletd test must have RPC port")
))?;
@ -2052,7 +2052,7 @@ async fn fully_synced_rpc_test() -> Result<()> {
let zebra_rpc_address = zebra_rpc_address.expect("lightwalletd test must have RPC port");
zebrad.expect_stdout_line_matches(&format!("Opened RPC endpoint at {zebra_rpc_address}"))?;
zebrad.expect_stdout_line_matches(format!("Opened RPC endpoint at {zebra_rpc_address}"))?;
let client = RPCRequestClient::new(zebra_rpc_address);

View File

@ -309,7 +309,7 @@ pub fn check_sync_logs_until(
mempool_behavior: MempoolBehavior,
check_legacy_chain: bool,
) -> Result<TestChild<TempDir>> {
zebrad.expect_stdout_line_matches(&format!("network: {network},"))?;
zebrad.expect_stdout_line_matches(format!("network: {network},"))?;
if check_legacy_chain {
zebrad.expect_stdout_line_matches("starting legacy chain check")?;
@ -417,7 +417,7 @@ pub fn create_cached_database_height(
.bypass_test_capture(true);
let network = format!("network: {network},");
child.expect_stdout_line_matches(&network)?;
child.expect_stdout_line_matches(network)?;
child.expect_stdout_line_matches("starting legacy chain check")?;
child.expect_stdout_line_matches("no legacy chain found")?;