Skip to content

Commit a88f483

Browse files
committed
Fix lints for Rust 1.84
1 parent 353d20a commit a88f483

File tree

49 files changed

+83
-79
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+83
-79
lines changed

Cargo.toml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -591,13 +591,18 @@ rust-2024-compatibility = { level = "warn", priority = -1 }
591591
edition_2024_expr_fragment_specifier = "allow"
592592
impl_trait_overcaptures = "allow"
593593
deprecated-safe-2024 = "allow"
594+
tail-expr-drop-order = "allow"
595+
if-let-rescope = "allow"
594596

595597
unused_qualifications = "warn"
596598

597599
# Code that needs unsafe should opt-in via a module-scoped allow.
598600
unsafe_code = "deny"
599601
unsafe_op_in_unsafe_fn = "forbid"
600602

603+
# TODO: Needed for xshell compatibility, fixed in v0.2.7
604+
unexpected_cfgs = { level = "warn", check-cfg = ['cfg(trick_rust_analyzer_into_highlighting_interpolated_bits)'] }
605+
601606
[workspace.lints.clippy]
602607
dbg_macro = "warn"
603608
debug_assert_with_mut_call = "warn"

openhcl/openhcl_boot/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -825,7 +825,7 @@ fn validate_vp_hw_ids(partition_info: &PartitionInfo) {
825825
if let Some((i, &vp_index)) = vp_indexes
826826
.iter()
827827
.enumerate()
828-
.find(|(i, &vp_index)| *i as u32 != vp_index)
828+
.find(|&(i, vp_index)| i as u32 != *vp_index)
829829
{
830830
panic!(
831831
"CPU hardware ID {:#x} does not correspond to VP index {}",

openhcl/sidecar_client/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -572,7 +572,7 @@ impl<'a> SidecarVp<'a> {
572572
match &mut *vp {
573573
VpState::Stopped => unreachable!(),
574574
VpState::Running(waker) => {
575-
if !waker.as_ref().map_or(false, |w| cx.waker().will_wake(w)) {
575+
if !waker.as_ref().is_some_and(|w| cx.waker().will_wake(w)) {
576576
*waker = Some(cx.waker().clone());
577577
}
578578
Poll::Pending

openhcl/underhill_confidentiality/src/getters.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ static CONFIDENTIAL: OnceLock<bool> = OnceLock::new();
77
static CONFIDENTIAL_DEBUG: OnceLock<bool> = OnceLock::new();
88

99
fn get_bool_env_var(name: &str) -> bool {
10-
std::env::var_os(name).map_or(false, |v| !v.is_empty() && v != "0")
10+
std::env::var_os(name).is_some_and(|v| !v.is_empty() && v != "0")
1111
}
1212

1313
/// Gets whether the current VM is a confidential VM.

openhcl/underhill_core/src/get_tracing.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ impl GetTracingBackend {
185185

186186
/// Enables tracing output to the tracing task and to stderr.
187187
pub fn init_tracing(spawn: impl Spawn, tracer: RemoteTracer) -> anyhow::Result<()> {
188-
if legacy_openvmm_env("OPENVMM_DISABLE_TRACING_RATELIMITS").map_or(false, |v| !v.is_empty()) {
188+
if legacy_openvmm_env("OPENVMM_DISABLE_TRACING_RATELIMITS").is_some_and(|v| !v.is_empty()) {
189189
tracelimit::disable_rate_limiting(true);
190190
}
191191

openhcl/underhill_crash/src/options.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ impl Options {
6262
);
6363

6464
let verbose_var = std::env::var("UNDERHILL_CRASH_VERBOSE").unwrap_or_default();
65-
let verbose = verbose_var == "1" || verbose_var.to_ascii_lowercase() == "true";
65+
let verbose = verbose_var == "1" || verbose_var.eq_ignore_ascii_case("true");
6666

6767
Self {
6868
pid,

openhcl/underhill_dump/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ pub fn main() -> ! {
3737
pub fn do_main() -> anyhow::Result<()> {
3838
let mut args = std::env::args().skip(1).peekable();
3939

40-
let level = if args.peek().map_or(false, |x| x == "-v") {
40+
let level = if args.peek().is_some_and(|x| x == "-v") {
4141
args.next();
4242
Level::DEBUG
4343
} else {

openhcl/virt_mshv_vtl/src/processor/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -669,7 +669,7 @@ impl<'p, T: Backing> Processor for UhProcessor<'p, T> {
669669
// Ensure the waker is set.
670670
if !last_waker
671671
.as_ref()
672-
.map_or(false, |waker| cx.waker().will_wake(waker))
672+
.is_some_and(|waker| cx.waker().will_wake(waker))
673673
{
674674
last_waker = Some(cx.waker().clone());
675675
self.inner.waker.write().clone_from(&last_waker);

openvmm/openvmm_entry/src/lib.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1329,9 +1329,9 @@ fn cleanup_socket(path: &Path) {
13291329
#[cfg(windows)]
13301330
let is_socket = pal::windows::fs::is_unix_socket(path).unwrap_or(false);
13311331
#[cfg(not(windows))]
1332-
let is_socket = path.metadata().map_or(false, |meta| {
1333-
std::os::unix::fs::FileTypeExt::is_socket(&meta.file_type())
1334-
});
1332+
let is_socket = path
1333+
.metadata()
1334+
.is_ok_and(|meta| std::os::unix::fs::FileTypeExt::is_socket(&meta.file_type()));
13351335

13361336
if is_socket {
13371337
let _ = std::fs::remove_file(path);

openvmm/openvmm_entry/src/tracing_init.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ pub fn enable_tracing() -> anyhow::Result<()> {
3737
.add_directive(base.parse().unwrap())
3838
};
3939

40-
if legacy_openvmm_env("OPENVMM_DISABLE_TRACING_RATELIMITS").map_or(false, |v| !v.is_empty()) {
40+
if legacy_openvmm_env("OPENVMM_DISABLE_TRACING_RATELIMITS").is_ok_and(|v| !v.is_empty()) {
4141
tracelimit::disable_rate_limiting(true);
4242
}
4343

support/cache_topology/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ mod linux {
190190
.file_name()
191191
.unwrap()
192192
.to_str()
193-
.map_or(false, |s| s.starts_with("index"))
193+
.is_some_and(|s| s.starts_with("index"))
194194
{
195195
continue;
196196
}

support/console_relay/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ fn choose_terminal_apps(app: Option<&Path>) -> Vec<App<'_>> {
9999

100100
let mut apps = Vec::new();
101101

102-
let env_set = |key| std::env::var_os(key).map_or(false, |x| !x.is_empty());
102+
let env_set = |key| std::env::var_os(key).is_some_and(|x| !x.is_empty());
103103

104104
// If we're running in tmux, use tmux.
105105
if env_set("TMUX") {

support/inspect_derive/src/lib.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ fn parse_attr_list<T: Parse>(input: ParseStream<'_>) -> syn::Result<Punctuated<A
264264
fn parse_attrs<T: Parse>(attrs: &[Attribute]) -> syn::Result<Vec<Attr<T>>> {
265265
let mut idents = Vec::new();
266266
for attr in attrs {
267-
if !attr.path().get_ident().map_or(false, |x| x == "inspect") {
267+
if attr.path().get_ident().is_none_or(|x| x != "inspect") {
268268
continue;
269269
}
270270
let attrs = attr.parse_args_with(parse_attr_list)?;
@@ -276,7 +276,7 @@ fn parse_attrs<T: Parse>(attrs: &[Attribute]) -> syn::Result<Vec<Attr<T>>> {
276276
/// Parses a `bitfield(u32)` style attribute, returning the bitfield type.
277277
fn parse_bitfield_attr(attrs: &[Attribute]) -> syn::Result<Option<Ident>> {
278278
for attr in attrs {
279-
if attr.path().get_ident().map_or(false, |x| x == "bitfield") {
279+
if attr.path().get_ident().is_some_and(|x| x == "bitfield") {
280280
return Ok(Some(attr.parse_args()?));
281281
}
282282
}
@@ -403,7 +403,7 @@ fn fields_response(
403403
&& field
404404
.ident
405405
.as_ref()
406-
.map_or(false, |id| id.to_string().starts_with('_'));
406+
.is_some_and(|id| id.to_string().starts_with('_'));
407407

408408
(!skip).then(|| {
409409
let ident = field.ident.as_ref().map_or_else(

support/mesh/mesh_channel_core/src/mpsc.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -510,7 +510,7 @@ impl ReceiverCore {
510510
if !local
511511
.waker
512512
.as_ref()
513-
.map_or(false, |waker| waker.will_wake(cx.waker()))
513+
.is_some_and(|waker| waker.will_wake(cx.waker()))
514514
&& !this.is_closed()
515515
{
516516
local.waker = Some(cx.waker().clone());

support/mesh/mesh_node/src/common.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ mod debug {
7474

7575
pub fn next(&self) -> Option<Uuid> {
7676
CHECK_ONCE.call_once(|| {
77-
if std::env::var_os("__MESH_UNSAFE_DEBUG_IDS__").map_or(false, |x| !x.is_empty()) {
77+
if std::env::var_os("__MESH_UNSAFE_DEBUG_IDS__").is_some_and(|x| !x.is_empty()) {
7878
tracing::error!("using unsafe debugging mesh IDs--this mesh could be compromised by external callers");
7979
USE_LINEAR_IDS.store(true, Ordering::Relaxed);
8080
}

support/mesh/mesh_protobuf/src/encoding.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1071,7 +1071,7 @@ impl<T, R, E: FieldEncode<T, R>> FieldEncode<Vec<T>, R> for VecField<E> {
10711071
// Other packed sequences may still get a bytes value at runtime, but
10721072
// they also support non-packed encodings and so must be wrapped when
10731073
// they're nested in another sequence.
1074-
let bytes = E::packed().map_or(false, |p| p.must_pack());
1074+
let bytes = E::packed().is_some_and(|p| p.must_pack());
10751075
!bytes
10761076
}
10771077
}
@@ -1116,7 +1116,7 @@ impl<'a, T, R, E: FieldDecode<'a, T, R>> FieldDecode<'a, Vec<T>, R> for VecField
11161116
// Other packed sequences may still get a bytes value at runtime, but
11171117
// they also support non-packed encodings and so must be wrapped when
11181118
// they're nested in another sequence.
1119-
let bytes = E::packed::<Vec<T>>().map_or(false, |p| p.must_pack());
1119+
let bytes = E::packed::<Vec<T>>().is_some_and(|p| p.must_pack());
11201120
!bytes
11211121
}
11221122
}

support/mesh/mesh_protobuf/src/protofile/writer.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ impl<'a> DescriptorWriter<'a> {
8080
let mut n = 0;
8181
while descriptors
8282
.peek()
83-
.map_or(false, |d| d.package == first.package)
83+
.is_some_and(|d| d.package == first.package)
8484
{
8585
let desc = descriptors.next().unwrap();
8686
desc.message.collect_imports(&mut writer, &mut imports)?;
@@ -376,7 +376,7 @@ impl FieldDescriptor<'_> {
376376
.collect::<Vec<_>>();
377377
let fields = fields
378378
.iter()
379-
.map(|(&ty, number, name)| FieldDescriptor::new("", ty, name.as_ref(), *number))
379+
.map(|&(ty, number, ref name)| FieldDescriptor::new("", *ty, name.as_ref(), number))
380380
.collect::<Vec<_>>();
381381
MessageDescriptor::new(&self.name.to_upper_camel_case(), "", &fields, &[], &[]).fmt(w)?;
382382
Ok(())

support/openssl_kdf/src/params.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ impl ParamsBuilder {
117117
// Data is allocated by the openssl allocator, so assumed in a memory stable realm.
118118
// It's important the data does not move from the time we create the "output" slice and the
119119
// moment it's read by the EVP_KDF_CTX_set_params functions.
120-
for (name, ref mut p) in &mut params.fixed {
120+
for (name, p) in &mut params.fixed {
121121
use Param::*;
122122
// SAFETY: Name is guaranteed to be a valid C string, and the bufs are only constructed by alloc_slice_inner,
123123
// which makes sure they are valid and have correct lengths.

support/pal/pal_async/src/interest.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ impl PollInterestSet {
261261
if !interest
262262
.waker
263263
.as_ref()
264-
.map_or(false, |w| w.will_wake(cx.waker()))
264+
.is_some_and(|w| w.will_wake(cx.waker()))
265265
{
266266
interest.waker = Some(cx.waker().clone());
267267
}

support/pal/pal_async/src/multi_waker.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ impl<const N: usize> Inner<N> {
2929
/// Sets the waker for index `i`.
3030
fn set(&self, i: usize, waker: &Waker) {
3131
let mut wakers = self.wakers.lock();
32-
if !wakers[i].as_ref().map_or(false, |old| old.will_wake(waker)) {
32+
if !wakers[i].as_ref().is_some_and(|old| old.will_wake(waker)) {
3333
let _old = wakers[i].replace(waker.clone());
3434
drop(wakers);
3535
}

support/pal/pal_async/src/windows/local.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ impl State {
111111
if !entry
112112
.waker
113113
.as_ref()
114-
.map_or(false, |old| old.will_wake(cx.waker()))
114+
.is_some_and(|old| old.will_wake(cx.waker()))
115115
{
116116
entry.waker = Some(cx.waker().clone());
117117
}

support/task_control/src/lib.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ impl<T: AsyncRun<S>, S> PollReady for StopTaskInner<'_, T, S> {
7777
if !shared
7878
.inner_waker
7979
.as_ref()
80-
.map_or(false, |waker| cx.waker().will_wake(waker))
80+
.is_some_and(|waker| cx.waker().will_wake(waker))
8181
{
8282
shared.inner_waker = Some(cx.waker().clone());
8383
}
@@ -468,9 +468,10 @@ impl<T: AsyncRun<S>, S: 'static + Send> TaskControl<T, S> {
468468
loop {
469469
let (mut task_and_state, stop) = poll_fn(|cx| {
470470
let mut shared = shared.lock();
471-
let has_work = shared.task_and_state.as_ref().map_or(false, |ts| {
472-
!shared.calls.is_empty() || (!shared.stop && !ts.done)
473-
});
471+
let has_work = shared
472+
.task_and_state
473+
.as_ref()
474+
.is_some_and(|ts| !shared.calls.is_empty() || (!shared.stop && !ts.done));
474475
if !has_work {
475476
shared.inner_waker = Some(cx.waker().clone());
476477
return Poll::Pending;

support/uevent/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,8 @@ impl UeventListener {
8383
|| (kvs.get("RESIZE") == Some("1")
8484
&& kvs.get("SUBSYSTEM") == Some("block")
8585
&& kvs.get("ACTION") == Some("change")
86-
&& kvs.get("MAJOR").map_or(false, |x| x.parse() == Ok(major))
87-
&& kvs.get("MINOR").map_or(false, |x| x.parse() == Ok(minor)))
86+
&& kvs.get("MAJOR").is_some_and(|x| x.parse() == Ok(major))
87+
&& kvs.get("MINOR").is_some_and(|x| x.parse() == Ok(minor)))
8888
{
8989
notify();
9090
}

vm/devices/chipset/src/i8042/ps2mouse.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ mod save_restore {
6565
type SavedState = state::SavedState;
6666

6767
fn save(&mut self) -> Result<Self::SavedState, SaveError> {
68-
let Self { ref output_buffer } = self;
68+
let Self { output_buffer } = self;
6969

7070
let saved_state = state::SavedState {
7171
output_buffer: output_buffer.iter().copied().collect(),

vm/devices/serial/serial_core/src/serial_io.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ impl<T: SerialIo + Unpin> SerialIo for DetachableIo<T> {
161161
self.inner
162162
.lock()
163163
.as_ref()
164-
.map_or(false, |s| s.is_connected())
164+
.is_some_and(|s| s.is_connected())
165165
}
166166

167167
fn poll_connect(&mut self, cx: &mut Context<'_>) -> Poll<io::Result<()>> {

vm/devices/storage/disk_layered/src/bitmap.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ impl Bitmap {
2828
.filter_map(move |bits| {
2929
let start = n;
3030
n += bits.len();
31-
if bits.first().map_or(false, |&x| !x) {
31+
if bits.first().is_some_and(|&x| !x) {
3232
Some(SectorBitmapRange {
3333
bits,
3434
start_sector: sector + start as u64,

vm/devices/storage/disk_nvme/nvme_driver/src/driver.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -492,7 +492,7 @@ impl<T: DeviceBacking> NvmeDriver<T> {
492492
.per_cpu
493493
.iter()
494494
.enumerate()
495-
.filter(|&(cpu, c)| c.get().map_or(false, |c| c.cpu != cpu as u32))
495+
.filter(|&(cpu, c)| c.get().is_some_and(|c| c.cpu != cpu as u32))
496496
.count()
497497
}
498498

vm/devices/support/fs/lxutil/src/windows/util.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -373,7 +373,7 @@ pub fn dos_to_nt_path(
373373
let path = if root.is_none() {
374374
// Windows has legacy behavior where specifying just a drive letter will return the last path on that drive
375375
// from the current cmd.exe instance. This is likely not the intended behavior and is generally not safe.
376-
if path.as_os_str().len() == 2 && path.to_str().map_or(false, |s| s.ends_with(':')) {
376+
if path.as_os_str().len() == 2 && path.to_str().is_some_and(|s| s.ends_with(':')) {
377377
windows::dos_to_nt_path(path.join("\\"))?
378378
} else {
379379
windows::dos_to_nt_path(path)?

vm/devices/virtio/virtio_p9/src/lib.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ pub struct VirtioPlan9Device {
2828
impl VirtioPlan9Device {
2929
pub fn new(tag: &str, fs: Plan9FileSystem, memory: GuestMemory) -> VirtioPlan9Device {
3030
// The tag uses the same format as 9p protocol strings (2 byte length followed by string).
31-
let length = tag.as_bytes().len() + size_of::<u16>();
31+
let length = tag.len() + size_of::<u16>();
3232

3333
// Round the length up to a multiple of 4 to make the read function simpler.
3434
let length = (length + 3) & !3;
@@ -38,9 +38,7 @@ impl VirtioPlan9Device {
3838
{
3939
use std::io::Write;
4040
let mut cursor = std::io::Cursor::new(&mut tag_buffer);
41-
cursor
42-
.write_all(&(tag.as_bytes().len() as u16).to_le_bytes())
43-
.unwrap();
41+
cursor.write_all(&(tag.len() as u16).to_le_bytes()).unwrap();
4442
cursor.write_all(tag.as_bytes()).unwrap();
4543
}
4644

vm/devices/virtio/virtiofs/src/virtio.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ impl VirtioFsDevice {
7474
};
7575

7676
// Copy the tag into the config space (truncate it for now if too long).
77-
let length = std::cmp::min(tag.as_bytes().len(), config.tag.len());
77+
let length = std::cmp::min(tag.len(), config.tag.len());
7878
config.tag[..length].copy_from_slice(&tag.as_bytes()[..length]);
7979

8080
Self {

vm/devices/vmbus/vmbus_ring/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1155,7 +1155,7 @@ pub fn inspect_ring<M: RingMem>(mem: M, req: inspect::Request<'_>) {
11551155
/// Returns whether a ring buffer is in a state where the receiving end might
11561156
/// need a signal.
11571157
pub fn reader_needs_signal<M: RingMem>(mem: M) -> bool {
1158-
InnerRing::new(mem).map_or(false, |ring| {
1158+
InnerRing::new(mem).is_ok_and(|ring| {
11591159
let control = ring.control();
11601160
control.interrupt_mask().load(Ordering::Relaxed) == 0
11611161
&& (control.inp().load(Ordering::Relaxed) != control.outp().load(Ordering::Relaxed))
@@ -1165,7 +1165,7 @@ pub fn reader_needs_signal<M: RingMem>(mem: M) -> bool {
11651165
/// Returns whether a ring buffer is in a state where the sending end might need
11661166
/// a signal.
11671167
pub fn writer_needs_signal<M: RingMem>(mem: M) -> bool {
1168-
InnerRing::new(mem).map_or(false, |ring| {
1168+
InnerRing::new(mem).is_ok_and(|ring| {
11691169
let control = ring.control();
11701170
let pending_size = control.pending_send_size().load(Ordering::Relaxed);
11711171
pending_size != 0

vm/vmcore/src/line_interrupt.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -459,7 +459,7 @@ pub mod test_helpers {
459459
}
460460

461461
pub fn is_high(&self, vector: u32) -> bool {
462-
self.state.lock().get(&vector).map_or(false, |s| s.is_high)
462+
self.state.lock().get(&vector).is_some_and(|s| s.is_high)
463463
}
464464

465465
pub fn poll_high(&self, cx: &mut Context<'_>, vector: u32) -> Poll<()> {

vm/vmcore/src/vmtime.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,7 @@ impl TimerState {
289289
}
290290

291291
// Update the timer if needed.
292-
if self.next.map_or(false, |next| next.is_before(time)) {
292+
if self.next.is_some_and(|next| next.is_before(time)) {
293293
return;
294294
}
295295
self.set_next(time);
@@ -305,7 +305,7 @@ impl TimerState {
305305
) -> Poll<Timestamp> {
306306
let now = self.now(now_os);
307307
let state = &mut self.waiters[index];
308-
if next.map_or(false, |next| next.is_before(now.vmtime)) {
308+
if next.is_some_and(|next| next.is_before(now.vmtime)) {
309309
state.waker = None;
310310
state.next = None;
311311
return Poll::Ready(now);

0 commit comments

Comments
 (0)