From 7e7f989545bac06ee674547425ac0ac907cc0bce Mon Sep 17 00:00:00 2001 From: teor Date: Sat, 28 Oct 2023 05:35:57 +1000 Subject: [PATCH] Fix new nightly clippy and rustc lints (#7860) --- zebra-chain/src/block.rs | 4 ++-- zebra-chain/src/transaction.rs | 2 +- zebra-network/src/peer.rs | 2 ++ 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/zebra-chain/src/block.rs b/zebra-chain/src/block.rs index 8b1e17ba35f..cee913dd5a4 100644 --- a/zebra-chain/src/block.rs +++ b/zebra-chain/src/block.rs @@ -78,8 +78,8 @@ impl Block { /// Verified blocks have a valid height. pub fn coinbase_height(&self) -> Option { self.transactions - .get(0) - .and_then(|tx| tx.inputs().get(0)) + .first() + .and_then(|tx| tx.inputs().first()) .and_then(|input| match input { transparent::Input::Coinbase { ref height, .. } => Some(*height), _ => None, diff --git a/zebra-chain/src/transaction.rs b/zebra-chain/src/transaction.rs index 583ca9681e8..3f099c2da77 100644 --- a/zebra-chain/src/transaction.rs +++ b/zebra-chain/src/transaction.rs @@ -511,7 +511,7 @@ impl Transaction { pub fn is_coinbase(&self) -> bool { self.inputs().len() == 1 && matches!( - self.inputs().get(0), + self.inputs().first(), Some(transparent::Input::Coinbase { .. }) ) } diff --git a/zebra-network/src/peer.rs b/zebra-network/src/peer.rs index 13498e9ba2f..b51db0adcf9 100644 --- a/zebra-network/src/peer.rs +++ b/zebra-network/src/peer.rs @@ -10,6 +10,7 @@ mod minimum_peer_version; mod priority; #[cfg(any(test, feature = "proptest-impl"))] +#[allow(unused_imports)] pub use client::tests::ClientTestHarness; #[cfg(test)] @@ -28,6 +29,7 @@ pub use error::{ErrorSlot, HandshakeError, PeerError, SharedPeerError}; pub use handshake::{ConnectedAddr, ConnectionInfo, Handshake, HandshakeRequest}; pub use load_tracked_client::LoadTrackedClient; pub use minimum_peer_version::MinimumPeerVersion; +#[allow(unused_imports)] pub use priority::{ address_is_valid_for_inbound_listeners, address_is_valid_for_outbound_connections, AttributePreference, PeerPreference,