From 8525c3c996413dd61224a748108cd29b62ac6e4b Mon Sep 17 00:00:00 2001 From: macpie Date: Fri, 6 Sep 2024 10:37:52 -0700 Subject: [PATCH] Fix clippy for rust 1.81 (#863) --- denylist/src/denylist.rs | 3 +-- iot_verifier/src/hex_density.rs | 9 ++++----- mobile_packet_verifier/src/accumulate.rs | 7 ++----- mobile_verifier/src/radio_threshold.rs | 8 ++------ mobile_verifier/src/subscriber_location.rs | 16 ++++------------ .../src/subscriber_verified_mapping_event.rs | 16 ++++------------ 6 files changed, 17 insertions(+), 42 deletions(-) diff --git a/denylist/src/denylist.rs b/denylist/src/denylist.rs index 80f75f6c5..f20e3bedd 100644 --- a/denylist/src/denylist.rs +++ b/denylist/src/denylist.rs @@ -145,9 +145,8 @@ pub fn filter_from_bin(bin: &[u8], sign_keys: &[PublicKey]) -> Result { let verified = sign_keys.iter().any(|pubkey| { filter .verify(pubkey) - .map(|res| { + .inspect(|_res| { tracing::info!(%pubkey, "valid denylist signer"); - res }) .is_ok() }); diff --git a/iot_verifier/src/hex_density.rs b/iot_verifier/src/hex_density.rs index 8e3932e19..9b89112d2 100644 --- a/iot_verifier/src/hex_density.rs +++ b/iot_verifier/src/hex_density.rs @@ -174,14 +174,13 @@ fn reduce_hex_res(unclipped: &mut HexMap, clipped: &mut HexMap, hex_list: Vec bool { - match authorization_verifier + authorization_verifier .verify_authorized_key(public_key, NetworkKeyRole::MobileRouter) .await - { - Ok(res) => res, - Err(_err) => false, - } + .unwrap_or_default() } async fn is_duplicate( diff --git a/mobile_verifier/src/radio_threshold.rs b/mobile_verifier/src/radio_threshold.rs index 158c31dd9..f3cfe8fe5 100644 --- a/mobile_verifier/src/radio_threshold.rs +++ b/mobile_verifier/src/radio_threshold.rs @@ -290,14 +290,10 @@ where } async fn verify_known_carrier_key(&self, public_key: &PublicKeyBinary) -> bool { - match self - .authorization_verifier + self.authorization_verifier .verify_authorized_key(public_key, NetworkKeyRole::MobileCarrier) .await - { - Ok(res) => res, - Err(_err) => false, - } + .unwrap_or_default() } async fn verify_legacy( diff --git a/mobile_verifier/src/subscriber_location.rs b/mobile_verifier/src/subscriber_location.rs index d7446a2df..1e35a63b2 100644 --- a/mobile_verifier/src/subscriber_location.rs +++ b/mobile_verifier/src/subscriber_location.rs @@ -181,25 +181,17 @@ where } async fn verify_known_carrier_key(&self, public_key: &PublicKeyBinary) -> bool { - match self - .authorization_verifier + self.authorization_verifier .verify_authorized_key(public_key, NetworkKeyRole::MobileCarrier) .await - { - Ok(res) => res, - Err(_err) => false, - } + .unwrap_or_default() } async fn verify_subscriber_id(&self, subscriber_id: &[u8]) -> bool { - match self - .entity_verifier + self.entity_verifier .verify_rewardable_entity(subscriber_id) .await - { - Ok(res) => res, - Err(_err) => false, - } + .unwrap_or_default() } } diff --git a/mobile_verifier/src/subscriber_verified_mapping_event.rs b/mobile_verifier/src/subscriber_verified_mapping_event.rs index 913ba9c51..32e20d839 100644 --- a/mobile_verifier/src/subscriber_verified_mapping_event.rs +++ b/mobile_verifier/src/subscriber_verified_mapping_event.rs @@ -189,25 +189,17 @@ where } async fn verify_known_carrier_key(&self, public_key: &PublicKeyBinary) -> bool { - match self - .authorization_verifier + self.authorization_verifier .verify_authorized_key(public_key, NetworkKeyRole::MobileCarrier) .await - { - Ok(res) => res, - Err(_err) => false, - } + .unwrap_or_default() } async fn verify_subscriber_id(&self, subscriber_id: &[u8]) -> bool { - match self - .entity_verifier + self.entity_verifier .verify_rewardable_entity(subscriber_id) .await - { - Ok(res) => res, - Err(_err) => false, - } + .unwrap_or_default() } }