Skip to content

Commit a4bb78a

Browse files
committed
style: cargo clippy
1 parent f1a2c93 commit a4bb78a

File tree

6 files changed

+10
-14
lines changed

6 files changed

+10
-14
lines changed

crates/service/src/routes/request_handler.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,7 @@ pub async fn request_handler(
3737

3838
let attestable = response
3939
.headers()
40-
.get(GRAPH_ATTESTABLE)
41-
.map_or(false, |value| {
40+
.get(GRAPH_ATTESTABLE).is_some_and(|value| {
4241
value.to_str().map(|value| value == "true").unwrap_or(false)
4342
});
4443

crates/service/src/tap/checks/sender_balance_check.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,7 @@ impl Check for SenderBalanceCheck {
3939
// Check that the sender has a non-zero balance -- more advanced accounting is done in
4040
// `tap-agent`.
4141
if !escrow_accounts_snapshot
42-
.get_balance_for_sender(receipt_sender)
43-
.map_or(false, |balance| balance > U256::ZERO)
42+
.get_balance_for_sender(receipt_sender).is_ok_and(|balance| balance > U256::ZERO)
4443
{
4544
return Err(CheckError::Failed(anyhow!(
4645
"Receipt sender `{}` does not have a sufficient balance",

crates/tap-agent/src/agent/sender_account.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -965,7 +965,7 @@ impl Actor for SenderAccount {
965965
tracing::error!("SenderAllocation doesn't have a name");
966966
return Ok(());
967967
};
968-
let Some(allocation_id) = allocation_id.split(':').last() else {
968+
let Some(allocation_id) = allocation_id.split(':').next_back() else {
969969
tracing::error!(%allocation_id, "Could not extract allocation_id from name");
970970
return Ok(());
971971
};
@@ -1003,7 +1003,7 @@ impl Actor for SenderAccount {
10031003
tracing::error!("SenderAllocation doesn't have a name");
10041004
return Ok(());
10051005
};
1006-
let Some(allocation_id) = allocation_id.split(':').last() else {
1006+
let Some(allocation_id) = allocation_id.split(':').next_back() else {
10071007
tracing::error!(%allocation_id, "Could not extract allocation_id from name");
10081008
return Ok(());
10091009
};

crates/tap-agent/src/agent/sender_accounts_manager.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ impl Actor for SenderAccountsManager {
243243
tracing::error!("SenderAllocation doesn't have a name");
244244
return Ok(());
245245
};
246-
let Some(sender_id) = sender_id.split(':').last() else {
246+
let Some(sender_id) = sender_id.split(':').next_back() else {
247247
tracing::error!(%sender_id, "Could not extract sender_id from name");
248248
return Ok(());
249249
};

crates/tap-agent/src/tap/context/receipt.rs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -274,14 +274,13 @@ mod test {
274274
range.contains(&received_receipt.signed_receipt().message.timestamp_ns)
275275
&& (received_receipt.signed_receipt().message.allocation_id
276276
== storage_adapter.allocation_id)
277-
&& (escrow_accounts_snapshot
277+
&& escrow_accounts_snapshot
278278
.get_sender_for_signer(
279279
&received_receipt
280280
.signed_receipt()
281281
.recover_signer(&TAP_EIP712_DOMAIN_SEPARATOR)
282282
.unwrap(),
283-
)
284-
.map_or(false, |v| v == storage_adapter.sender))
283+
).is_ok_and(|v| v == storage_adapter.sender)
285284
})
286285
.cloned()
287286
.collect();
@@ -340,14 +339,13 @@ mod test {
340339
.filter(|(_, received_receipt)| {
341340
if (received_receipt.signed_receipt().message.allocation_id
342341
== storage_adapter.allocation_id)
343-
&& (escrow_accounts_snapshot
342+
&& escrow_accounts_snapshot
344343
.get_sender_for_signer(
345344
&received_receipt
346345
.signed_receipt()
347346
.recover_signer(&TAP_EIP712_DOMAIN_SEPARATOR)
348347
.unwrap(),
349-
)
350-
.map_or(false, |v| v == storage_adapter.sender))
348+
).is_ok_and(|v| v == storage_adapter.sender)
351349
{
352350
!range.contains(&received_receipt.signed_receipt().message.timestamp_ns)
353351
} else {

crates/tap-agent/tests/tap_agent_test.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ async fn test_start_tap_agent(pgpool: PgPool) {
168168
// This would select the 3 defined allocations in order
169169
let allocation_selected = (i % 3) as usize;
170170
let receipt = create_received_receipt(
171-
&allocations.get(allocation_selected).unwrap(),
171+
allocations.get(allocation_selected).unwrap(),
172172
&TAP_SIGNER.0,
173173
i,
174174
i + 1,

0 commit comments

Comments
 (0)