Skip to content

Commit

Permalink
refactor(ordermatch): try_get_age_or_default has been simplified a li…
Browse files Browse the repository at this point in the history
…ttle
  • Loading branch information
rozhkovdmitrii committed Jun 9, 2023
1 parent 4df5491 commit b8b298f
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions mm2src/mm2_main/src/lp_ordermatch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3959,9 +3959,10 @@ struct OrderbookP2PItem {
macro_rules! try_get_age_or_default {
($created_at: expr) => {{
let now = now_sec();
now.checked_sub($created_at)
.ok_or_else(|| warn!("now - created_at: ({} - {}) caused a u64 underflow.", now, $created_at))
.unwrap_or_default()
now.checked_sub($created_at).unwrap_or_else(|| {
warn!("now - created_at: ({} - {}) caused a u64 underflow.", now, $created_at);
Default::default()
})
}};
}

Expand Down

0 comments on commit b8b298f

Please sign in to comment.