Skip to content

Commit

Permalink
Clippy updates for 1.84.0 (#929)
Browse files Browse the repository at this point in the history
* remove unneccessary lifetimes

* Update for new clippy lint about map_or

https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_map_or
  • Loading branch information
michaeldjeffrey authored Jan 14, 2025
1 parent 8ced78b commit 40abfa0
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 16 deletions.
2 changes: 1 addition & 1 deletion boost_manager/src/updater.rs
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ where
Ok(())
}

async fn confirm_txn<'a>(&self, txn_row: &TxnRow) -> Result<()> {
async fn confirm_txn(&self, txn_row: &TxnRow) -> Result<()> {
if self.solana.confirm_transaction(&txn_row.txn_id).await? {
tracing::info!("txn_id {} confirmed on chain, updated db", txn_row.txn_id);
db::update_verified_txns_onchain(&self.pool, &txn_row.txn_id).await?
Expand Down
2 changes: 1 addition & 1 deletion file_store/src/file_sink.rs
Original file line number Diff line number Diff line change
Expand Up @@ -676,7 +676,7 @@ mod tests {
.file_name()
.to_str()
.and_then(|file_name| FileInfo::from_str(file_name).ok())
.map_or(false, |file_info| {
.is_some_and(|file_info| {
FileType::from_str(&file_info.prefix).expect("entropy report prefix")
== FileType::EntropyReport
})
Expand Down
12 changes: 6 additions & 6 deletions iot_config/src/route_service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,11 @@ impl RouteService {
self.update_channel.clone()
}

async fn verify_request_signature<'a, R>(
async fn verify_request_signature<R>(
&self,
signer: &PublicKey,
request: &R,
id: OrgId<'a>,
id: OrgId<'_>,
) -> Result<(), Status>
where
R: MsgVerify,
Expand Down Expand Up @@ -117,11 +117,11 @@ impl RouteService {
}
}

async fn verify_request_signature_or_stream<'a, R>(
async fn verify_request_signature_or_stream<R>(
&self,
signer: &PublicKey,
request: &R,
id: OrgId<'a>,
id: OrgId<'_>,
) -> Result<(), Status>
where
R: MsgVerify,
Expand Down Expand Up @@ -151,9 +151,9 @@ impl RouteService {
DevAddrEuiValidator::new(route_id, admin_keys, &self.pool, check_constraints).await
}

async fn validate_skf_devaddrs<'a>(
async fn validate_skf_devaddrs(
&self,
route_id: &'a str,
route_id: &str,
updates: &[route_skf_update_req_v1::RouteSkfUpdateV1],
) -> Result<(), Status> {
let ranges: Vec<DevAddrRange> = route::list_devaddr_ranges_for_route(route_id, &self.pool)
Expand Down
7 changes: 3 additions & 4 deletions iot_verifier/src/runner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -514,7 +514,7 @@ where
.witness_updater
.get_last_witness(&beacon_report.report.pub_key)
.await?;
Ok(last_witness.map_or(false, |lw| {
Ok(last_witness.is_some_and(|lw| {
beacon_report.received_timestamp - lw.timestamp < *RECIPROCITY_WINDOW
}))
}
Expand Down Expand Up @@ -544,9 +544,8 @@ where
) -> anyhow::Result<bool> {
let last_beacon_recip =
LastBeaconReciprocity::get(&self.pool, &report.report.pub_key).await?;
Ok(last_beacon_recip.map_or(false, |lw| {
report.received_timestamp - lw.timestamp < *RECIPROCITY_WINDOW
}))
Ok(last_beacon_recip
.is_some_and(|lw| report.received_timestamp - lw.timestamp < *RECIPROCITY_WINDOW))
}
}

Expand Down
4 changes: 2 additions & 2 deletions mobile_verifier/src/coverage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -547,11 +547,11 @@ impl CoverageClaimTimeCache {
Self { cache }
}

pub async fn fetch_coverage_claim_time<'a, 'b>(
pub async fn fetch_coverage_claim_time<'a>(
&self,
radio_key: KeyType<'a>,
coverage_object: &'a Option<Uuid>,
exec: &mut Transaction<'b, Postgres>,
exec: &mut Transaction<'_, Postgres>,
) -> Result<Option<DateTime<Utc>>, sqlx::Error> {
let key = (radio_key.to_id(), *coverage_object);
if let Some(coverage_claim_time) = self.cache.get(&key).await {
Expand Down
2 changes: 1 addition & 1 deletion mobile_verifier/src/data_session.rs
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ pub async fn sum_data_sessions_to_dc_by_payer<'a>(
.collect::<HashMap<String, u64>>())
}

pub async fn data_sessions_to_dc<'a>(
pub async fn data_sessions_to_dc(
stream: impl Stream<Item = Result<HotspotDataSession, sqlx::Error>>,
) -> Result<HotspotMap, sqlx::Error> {
tokio::pin!(stream);
Expand Down
2 changes: 1 addition & 1 deletion mobile_verifier/src/speedtests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ pub async fn get_latest_speedtests_for_pubkey(
Ok(speedtests)
}

pub async fn aggregate_epoch_speedtests<'a>(
pub async fn aggregate_epoch_speedtests(
epoch_end: DateTime<Utc>,
exec: &sqlx::Pool<sqlx::Postgres>,
) -> Result<EpochSpeedTests, sqlx::Error> {
Expand Down

0 comments on commit 40abfa0

Please sign in to comment.