mirror of
https://github.com/tokio-rs/tokio.git
synced 2026-09-08 00:00:13 +02:00
time: clean up redundant check in Wheel::poll() (#5574)
The condition checked in the and_then() call is the same as is checked in the match below, so we can clean it up by just matching on next_expiration() directly.
This commit is contained in:
@@ -148,23 +148,13 @@ impl Wheel {
|
|||||||
return Some(handle);
|
return Some(handle);
|
||||||
}
|
}
|
||||||
|
|
||||||
// under what circumstances is poll.expiration Some vs. None?
|
match self.next_expiration() {
|
||||||
let expiration = self.next_expiration().and_then(|expiration| {
|
Some(ref expiration) if expiration.deadline <= now => {
|
||||||
if expiration.deadline > now {
|
|
||||||
None
|
|
||||||
} else {
|
|
||||||
Some(expiration)
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
match expiration {
|
|
||||||
Some(ref expiration) if expiration.deadline > now => return None,
|
|
||||||
Some(ref expiration) => {
|
|
||||||
self.process_expiration(expiration);
|
self.process_expiration(expiration);
|
||||||
|
|
||||||
self.set_elapsed(expiration.deadline);
|
self.set_elapsed(expiration.deadline);
|
||||||
}
|
}
|
||||||
None => {
|
_ => {
|
||||||
// in this case the poll did not indicate an expiration
|
// in this case the poll did not indicate an expiration
|
||||||
// _and_ we were not able to find a next expiration in
|
// _and_ we were not able to find a next expiration in
|
||||||
// the current list of timers. advance to the poll's
|
// the current list of timers. advance to the poll's
|
||||||
|
|||||||
Reference in New Issue
Block a user