fix(clippy): Fix nightly clippy redundant code lints (#5916)
* Remove needless borrows * Remove redundant into_iter() * Remove unnecessary clone()
This commit is contained in:
parent
f3f8254e4a
commit
2f23de80f1
|
@ -737,7 +737,6 @@ where
|
||||||
let upgrade = request.upgrade(network);
|
let upgrade = request.upgrade(network);
|
||||||
|
|
||||||
let script_checks = (0..inputs.len())
|
let script_checks = (0..inputs.len())
|
||||||
.into_iter()
|
|
||||||
.map(move |input_index| {
|
.map(move |input_index| {
|
||||||
let request = script::Request {
|
let request = script::Request {
|
||||||
upgrade,
|
upgrade,
|
||||||
|
|
|
@ -260,7 +260,7 @@ impl ChainTipSender {
|
||||||
|
|
||||||
span.record(
|
span.record(
|
||||||
"old_use_non_finalized_tip",
|
"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 height = tip.as_ref().map(|block| block.height);
|
||||||
let hash = tip.as_ref().map(|block| block.hash);
|
let hash = tip.as_ref().map(|block| block.hash);
|
||||||
|
|
||||||
span.record(format!("{prefix}_height").as_str(), &field::debug(height));
|
span.record(format!("{prefix}_height").as_str(), field::debug(height));
|
||||||
span.record(format!("{prefix}_hash").as_str(), &field::debug(hash));
|
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>| {
|
let register_span_fields = |chain_tip_block: Option<&ChainTipBlock>| {
|
||||||
span.record(
|
span.record(
|
||||||
"height",
|
"height",
|
||||||
&tracing::field::debug(chain_tip_block.map(|block| block.height)),
|
tracing::field::debug(chain_tip_block.map(|block| block.height)),
|
||||||
);
|
);
|
||||||
span.record(
|
span.record(
|
||||||
"hash",
|
"hash",
|
||||||
&tracing::field::debug(chain_tip_block.map(|block| block.hash)),
|
tracing::field::debug(chain_tip_block.map(|block| block.hash)),
|
||||||
);
|
);
|
||||||
span.record(
|
span.record(
|
||||||
"time",
|
"time",
|
||||||
&tracing::field::debug(chain_tip_block.map(|block| block.time)),
|
tracing::field::debug(chain_tip_block.map(|block| block.time)),
|
||||||
);
|
);
|
||||||
span.record(
|
span.record(
|
||||||
"previous_hash",
|
"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(
|
span.record(
|
||||||
"transaction_count",
|
"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())),
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -327,7 +327,7 @@ where
|
||||||
// TODO: implement Step for Height, when Step stabilises
|
// TODO: implement Step for Height, when Step stabilises
|
||||||
// https://github.com/rust-lang/rust/issues/42168
|
// https://github.com/rust-lang/rust/issues/42168
|
||||||
let height_range = start_height.0..=final_height.0;
|
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!(
|
tracing::debug!(
|
||||||
?start_height,
|
?start_height,
|
||||||
|
|
|
@ -232,7 +232,7 @@ impl Service<zn::Request> for Inbound {
|
||||||
|
|
||||||
let block_downloads = Box::pin(BlockDownloads::new(
|
let block_downloads = Box::pin(BlockDownloads::new(
|
||||||
full_verify_concurrency_limit,
|
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),
|
Timeout::new(block_verifier, BLOCK_VERIFY_TIMEOUT),
|
||||||
state.clone(),
|
state.clone(),
|
||||||
latest_chain_tip,
|
latest_chain_tip,
|
||||||
|
|
|
@ -135,8 +135,7 @@ fn mempool_storage_basic_for_network(network: Network) -> Result<()> {
|
||||||
.collect();
|
.collect();
|
||||||
|
|
||||||
// Convert response to a `HashSet`, because the order of the response doesn't matter.
|
// Convert response to a `HashSet`, because the order of the response doesn't matter.
|
||||||
let all_rejected_ids: HashSet<UnminedTxId> =
|
let all_rejected_ids: HashSet<UnminedTxId> = storage.rejected_transactions(all_ids).collect();
|
||||||
storage.rejected_transactions(all_ids).into_iter().collect();
|
|
||||||
|
|
||||||
let some_rejected_ids = some_rejected_transactions
|
let some_rejected_ids = some_rejected_transactions
|
||||||
.iter()
|
.iter()
|
||||||
|
|
|
@ -1638,7 +1638,7 @@ fn lightwalletd_integration_test(test_type: TestType) -> Result<()> {
|
||||||
?zebra_rpc_address,
|
?zebra_rpc_address,
|
||||||
"waiting for zebrad to open its RPC port..."
|
"waiting for zebrad to open its RPC port..."
|
||||||
);
|
);
|
||||||
zebrad.expect_stdout_line_matches(&format!(
|
zebrad.expect_stdout_line_matches(format!(
|
||||||
"Opened RPC endpoint at {}",
|
"Opened RPC endpoint at {}",
|
||||||
zebra_rpc_address.expect("lightwalletd test must have RPC port")
|
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");
|
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);
|
let client = RPCRequestClient::new(zebra_rpc_address);
|
||||||
|
|
||||||
|
|
|
@ -309,7 +309,7 @@ pub fn check_sync_logs_until(
|
||||||
mempool_behavior: MempoolBehavior,
|
mempool_behavior: MempoolBehavior,
|
||||||
check_legacy_chain: bool,
|
check_legacy_chain: bool,
|
||||||
) -> Result<TestChild<TempDir>> {
|
) -> Result<TestChild<TempDir>> {
|
||||||
zebrad.expect_stdout_line_matches(&format!("network: {network},"))?;
|
zebrad.expect_stdout_line_matches(format!("network: {network},"))?;
|
||||||
|
|
||||||
if check_legacy_chain {
|
if check_legacy_chain {
|
||||||
zebrad.expect_stdout_line_matches("starting legacy chain check")?;
|
zebrad.expect_stdout_line_matches("starting legacy chain check")?;
|
||||||
|
@ -417,7 +417,7 @@ pub fn create_cached_database_height(
|
||||||
.bypass_test_capture(true);
|
.bypass_test_capture(true);
|
||||||
|
|
||||||
let network = format!("network: {network},");
|
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("starting legacy chain check")?;
|
||||||
child.expect_stdout_line_matches("no legacy chain found")?;
|
child.expect_stdout_line_matches("no legacy chain found")?;
|
||||||
|
|
Loading…
Reference in New Issue