Skip to content

Commit

Permalink
Applying clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
muhamadazmy committed Jun 8, 2022
1 parent 41cdd88 commit 0bbf429
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 11 deletions.
2 changes: 1 addition & 1 deletion src/http_workers/work_runner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ where
// signing the message
msg.sign(&self.identity);

result = self.send_once(&twin, &queue, &msg).await;
result = self.send_once(&twin, &queue, msg).await;
if let Err(SendError::Error(_)) = &result {
continue;
}
Expand Down
12 changes: 2 additions & 10 deletions src/types/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -168,12 +168,7 @@ impl Message {

// to compute the ttl we need to do the following
// - ttl = expiration - (now - msg.timestamp)
let d = match now.checked_sub(self.timestamp) {
Some(d) => d,
None => 0,
};

Duration::from_secs(d)
Duration::from_secs(now.saturating_sub(self.timestamp))
}
}

Expand Down Expand Up @@ -234,10 +229,7 @@ fn stamp(now: u64, ts: u64, exp: u64) -> (u64, u64) {
// we checked above so we sure that du is 0 or higher (no overflow)
let du = now - ts;

let exp = match exp.checked_sub(du) {
Some(v) => v,
None => 0,
};
let exp = exp.saturating_sub(du);

(now, exp)
}
Expand Down

0 comments on commit 0bbf429

Please sign in to comment.