cleanup(clippy): Remove redundant bindings, allocations, and generics (#4353)
* Remove let bindings with unit values * Replace push(format!(_)) with write!(_) * Remove unused lifetime in test
This commit is contained in:
parent
7262211bdf
commit
a98e9291b5
|
@ -38,7 +38,7 @@ impl Ed25519Verifier {
|
||||||
|
|
||||||
pub type Ed25519Item = batch::Item;
|
pub type Ed25519Item = batch::Item;
|
||||||
|
|
||||||
impl<'msg> Service<BatchControl<Ed25519Item>> for Ed25519Verifier {
|
impl Service<BatchControl<Ed25519Item>> for Ed25519Verifier {
|
||||||
type Response = ();
|
type Response = ();
|
||||||
type Error = Error;
|
type Error = Error;
|
||||||
type Future = Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'static>>;
|
type Future = Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'static>>;
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
//! Zebrad Abscissa Application
|
//! Zebrad Abscissa Application
|
||||||
|
|
||||||
use std::{io::Write, process};
|
use std::{fmt::Write as _, io::Write as _, process};
|
||||||
|
|
||||||
use abscissa_core::{
|
use abscissa_core::{
|
||||||
application::{self, fatal_error, AppCell},
|
application::{self, fatal_error, AppCell},
|
||||||
|
@ -263,7 +263,8 @@ impl Application for ZebradApp {
|
||||||
let mut metadata_section = "Metadata:".to_string();
|
let mut metadata_section = "Metadata:".to_string();
|
||||||
for (k, v) in panic_metadata {
|
for (k, v) in panic_metadata {
|
||||||
builder = builder.add_issue_metadata(k, v.clone());
|
builder = builder.add_issue_metadata(k, v.clone());
|
||||||
metadata_section.push_str(&format!("\n{}: {}", k, &v));
|
write!(&mut metadata_section, "\n{}: {}", k, &v)
|
||||||
|
.expect("unexpected failure writing to string");
|
||||||
}
|
}
|
||||||
|
|
||||||
builder = builder
|
builder = builder
|
||||||
|
|
|
@ -371,7 +371,7 @@ impl Service<Request> for Mempool {
|
||||||
|
|
||||||
// Send transactions that were not rejected nor expired to peers
|
// Send transactions that were not rejected nor expired to peers
|
||||||
if !send_to_peers_ids.is_empty() {
|
if !send_to_peers_ids.is_empty() {
|
||||||
let _ = self.transaction_sender.send(send_to_peers_ids)?;
|
self.transaction_sender.send(send_to_peers_ids)?;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -55,7 +55,7 @@ async fn mempool_service_basic_single() -> Result<(), Report> {
|
||||||
setup(network, cost_limit).await;
|
setup(network, cost_limit).await;
|
||||||
|
|
||||||
// Enable the mempool
|
// Enable the mempool
|
||||||
let _ = service.enable(&mut recent_syncs).await;
|
service.enable(&mut recent_syncs).await;
|
||||||
|
|
||||||
// Insert the genesis block coinbase transaction into the mempool storage.
|
// Insert the genesis block coinbase transaction into the mempool storage.
|
||||||
let mut inserted_ids = HashSet::new();
|
let mut inserted_ids = HashSet::new();
|
||||||
|
@ -202,7 +202,7 @@ async fn mempool_queue_single() -> Result<(), Report> {
|
||||||
setup(network, cost_limit).await;
|
setup(network, cost_limit).await;
|
||||||
|
|
||||||
// Enable the mempool
|
// Enable the mempool
|
||||||
let _ = service.enable(&mut recent_syncs).await;
|
service.enable(&mut recent_syncs).await;
|
||||||
|
|
||||||
// Insert [transactions...] into the mempool storage.
|
// Insert [transactions...] into the mempool storage.
|
||||||
// This will cause the at least one transaction to be rejected, since
|
// This will cause the at least one transaction to be rejected, since
|
||||||
|
@ -286,7 +286,7 @@ async fn mempool_service_disabled() -> Result<(), Report> {
|
||||||
assert!(!service.is_enabled());
|
assert!(!service.is_enabled());
|
||||||
|
|
||||||
// Enable the mempool
|
// Enable the mempool
|
||||||
let _ = service.enable(&mut recent_syncs).await;
|
service.enable(&mut recent_syncs).await;
|
||||||
|
|
||||||
assert!(service.is_enabled());
|
assert!(service.is_enabled());
|
||||||
|
|
||||||
|
@ -325,7 +325,7 @@ async fn mempool_service_disabled() -> Result<(), Report> {
|
||||||
assert_eq!(service.tx_downloads().in_flight(), 1);
|
assert_eq!(service.tx_downloads().in_flight(), 1);
|
||||||
|
|
||||||
// Disable the mempool
|
// Disable the mempool
|
||||||
let _ = service.disable(&mut recent_syncs).await;
|
service.disable(&mut recent_syncs).await;
|
||||||
|
|
||||||
// Test if mempool is disabled again
|
// Test if mempool is disabled again
|
||||||
assert!(!service.is_enabled());
|
assert!(!service.is_enabled());
|
||||||
|
@ -393,7 +393,7 @@ async fn mempool_cancel_mined() -> Result<(), Report> {
|
||||||
time::pause();
|
time::pause();
|
||||||
|
|
||||||
// Enable the mempool
|
// Enable the mempool
|
||||||
let _ = mempool.enable(&mut recent_syncs).await;
|
mempool.enable(&mut recent_syncs).await;
|
||||||
assert!(mempool.is_enabled());
|
assert!(mempool.is_enabled());
|
||||||
|
|
||||||
// Push the genesis block to the state
|
// Push the genesis block to the state
|
||||||
|
@ -486,7 +486,7 @@ async fn mempool_cancel_downloads_after_network_upgrade() -> Result<(), Report>
|
||||||
setup(network, u64::MAX).await;
|
setup(network, u64::MAX).await;
|
||||||
|
|
||||||
// Enable the mempool
|
// Enable the mempool
|
||||||
let _ = mempool.enable(&mut recent_syncs).await;
|
mempool.enable(&mut recent_syncs).await;
|
||||||
assert!(mempool.is_enabled());
|
assert!(mempool.is_enabled());
|
||||||
|
|
||||||
// Push the genesis block to the state
|
// Push the genesis block to the state
|
||||||
|
@ -560,7 +560,7 @@ async fn mempool_failed_verification_is_rejected() -> Result<(), Report> {
|
||||||
time::pause();
|
time::pause();
|
||||||
|
|
||||||
// Enable the mempool
|
// Enable the mempool
|
||||||
let _ = mempool.enable(&mut recent_syncs).await;
|
mempool.enable(&mut recent_syncs).await;
|
||||||
|
|
||||||
// Push the genesis block to the state, since downloader needs a valid tip.
|
// Push the genesis block to the state, since downloader needs a valid tip.
|
||||||
let genesis_block: Arc<Block> = zebra_test::vectors::BLOCK_MAINNET_GENESIS_BYTES
|
let genesis_block: Arc<Block> = zebra_test::vectors::BLOCK_MAINNET_GENESIS_BYTES
|
||||||
|
@ -645,7 +645,7 @@ async fn mempool_failed_download_is_not_rejected() -> Result<(), Report> {
|
||||||
time::pause();
|
time::pause();
|
||||||
|
|
||||||
// Enable the mempool
|
// Enable the mempool
|
||||||
let _ = mempool.enable(&mut recent_syncs).await;
|
mempool.enable(&mut recent_syncs).await;
|
||||||
|
|
||||||
// Push the genesis block to the state, since downloader needs a valid tip.
|
// Push the genesis block to the state, since downloader needs a valid tip.
|
||||||
let genesis_block: Arc<Block> = zebra_test::vectors::BLOCK_MAINNET_GENESIS_BYTES
|
let genesis_block: Arc<Block> = zebra_test::vectors::BLOCK_MAINNET_GENESIS_BYTES
|
||||||
|
|
Loading…
Reference in New Issue