ticktimer: use sleep_heap.pop_first()

This function was stabilized in Rust 1.66.0.

Signed-off-by: Sean Cross <sean@xobs.io>
This commit is contained in:
Sean Cross 2023-01-29 18:01:18 +08:00
parent c541c1b000
commit 3b7b49b4da

View file

@ -465,11 +465,7 @@ fn start_sleep(
sleep_heap: &mut BTreeMap<TimeoutExpiry, TimerRequest>, // min-heap with Reverse
) {
// If there are items in the sleep heap, take the next item that will expire.
// TODO: Replace this with `.min()` when it's stabilized:
// https://github.com/rust-lang/rust/issues/62924
let next_timeout_msec = sleep_heap.iter().min().map(|(msec, _)| *msec);
if let Some(msec) = next_timeout_msec {
let next_response = sleep_heap.remove(&msec).unwrap();
if let Some((_msec, next_response)) = sleep_heap.pop_first() {
#[cfg(feature = "debug-print")]
info!(
"scheduling a response at {} to {} (heap: {:?})",