Skip to content

Commit

Permalink
chore: make clippy happy (#1677)
Browse files Browse the repository at this point in the history
  • Loading branch information
mattsse authored Nov 22, 2024
1 parent 93325b2 commit 4b43094
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions crates/consensus/src/transaction/eip4844.rs
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ impl RlpEcdsaTx for TxEip4844Variant {
// - If there is a string header, this is a non-sidecar tx with a multi-byte chain ID.
// To check these, we first try to decode the header. If it fails or is
// not a list, we lmow that it is a non-sidecar transaction.
if Header::decode(needle).map_or(false, |h| h.list) {
if Header::decode(needle).is_ok_and(|h| h.list) {
if let Ok(tx) = TxEip4844WithSidecar::rlp_decode_fields(trial) {
*buf = *trial;
return Ok(tx.into());
Expand All @@ -332,7 +332,7 @@ impl RlpEcdsaTx for TxEip4844Variant {
// - If there is a string header, this is a non-sidecar tx with a multi-byte chain ID.
// To check these, we first try to decode the header. If it fails or is
// not a list, we lmow that it is a non-sidecar transaction.
if Header::decode(needle).map_or(false, |h| h.list) {
if Header::decode(needle).is_ok_and(|h| h.list) {
if let Ok((tx, signature)) = TxEip4844WithSidecar::rlp_decode_with_signature(trial) {
// If succesful, we need to consume the trial buffer up to
// the same point.
Expand Down
4 changes: 2 additions & 2 deletions crates/contract/src/event.rs
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,8 @@ impl<T: Transport + Clone, P: Provider<T, N>, E: SolEvent, N: Network> Event<T,
/// This means that both `from_block` and `to_block` are set to the pending
/// tag.
pub fn is_pending_block_filter(&self) -> bool {
self.filter.block_option.get_from_block().map_or(false, BlockNumberOrTag::is_pending)
&& self.filter.block_option.get_to_block().map_or(false, BlockNumberOrTag::is_pending)
self.filter.block_option.get_from_block().is_some_and(BlockNumberOrTag::is_pending)
&& self.filter.block_option.get_to_block().is_some_and(BlockNumberOrTag::is_pending)
}

/// Pins the block hash for the filter
Expand Down
4 changes: 2 additions & 2 deletions crates/genesis/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -534,12 +534,12 @@ impl ChainConfig {

// Private function handling the comparison logic for block numbers
fn is_active_at_block(&self, config_block: Option<u64>, block: u64) -> bool {
config_block.map_or(false, |cb| cb <= block)
config_block.is_some_and(|cb| cb <= block)
}

// Private function handling the comparison logic for timestamps
fn is_active_at_timestamp(&self, config_timestamp: Option<u64>, timestamp: u64) -> bool {
config_timestamp.map_or(false, |cb| cb <= timestamp)
config_timestamp.is_some_and(|cb| cb <= timestamp)
}
}

Expand Down
6 changes: 3 additions & 3 deletions crates/rpc-types-eth/src/filter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -418,8 +418,8 @@ impl Filter {
/// Return `true` if filter configured to match pending block.
/// This means that both from_block and to_block are set to the pending tag.
pub fn is_pending_block_filter(&self) -> bool {
self.block_option.get_from_block().map_or(false, BlockNumberOrTag::is_pending)
&& self.block_option.get_to_block().map_or(false, BlockNumberOrTag::is_pending)
self.block_option.get_from_block().is_some_and(BlockNumberOrTag::is_pending)
&& self.block_option.get_to_block().is_some_and(BlockNumberOrTag::is_pending)
}

/// Pins the block hash for the filter
Expand Down Expand Up @@ -894,7 +894,7 @@ impl FilteredParams {
/// This means that both from_block and to_block are set to the pending tag.
/// It calls [`Filter::is_pending_block_filter`] undercover.
pub fn is_pending_block_filter(&self) -> bool {
self.filter.as_ref().map_or(false, |f| f.is_pending_block_filter())
self.filter.as_ref().is_some_and(|f| f.is_pending_block_filter())
}

/// Returns `true` if the filter matches the given address.
Expand Down
2 changes: 1 addition & 1 deletion crates/transport/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ where
/// or the hostname is `localhost` or `127.0.0.1`.
pub fn guess_local_url(s: impl AsRef<str>) -> bool {
fn _guess_local_url(url: &str) -> bool {
url.parse::<Url>().map_or(false, |url| {
url.parse::<Url>().is_ok_and(|url| {
url.host_str().map_or(true, |host| host == "localhost" || host == "127.0.0.1")
})
}
Expand Down

0 comments on commit 4b43094

Please sign in to comment.