From 491593a6dc432728ae6b434f072f7d5d0a0f917b Mon Sep 17 00:00:00 2001 From: Carl Lerche Date: Fri, 1 Mar 2024 09:33:39 -0800 Subject: [PATCH] minor style change --- src/sys/windows/named_pipe.rs | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/src/sys/windows/named_pipe.rs b/src/sys/windows/named_pipe.rs index 3081ba555..8ec075d5a 100644 --- a/src/sys/windows/named_pipe.rs +++ b/src/sys/windows/named_pipe.rs @@ -942,16 +942,18 @@ fn event_done(status: &OVERLAPPED_ENTRY, events: Option<&mut Vec>) { let io = me.io.lock().unwrap(); // Make sure the I/O handle is still registered with the selector - // - // This method is also called during `Selector::drop` to perform cleanup. In - // this case, `events` is `None` and we don't need to track the event. - if io.token.is_some() && events.is_some() { - let mut ev = Event::from_completion_status(&status); - // Reverse the `.data` alteration done in `schedule_event`. This - // alteration was done so the selector recognized the event as one from - // a named pipe. - ev.data >>= 1; - events.expect("events must be some").push(ev); + if io.token.is_some() { + // This method is also called during `Selector::drop` to perform + // cleanup. In this case, `events` is `None` and we don't need to track + // the event. + if let Some(events) = events { + let mut ev = Event::from_completion_status(&status); + // Reverse the `.data` alteration done in `schedule_event`. This + // alteration was done so the selector recognized the event as one from + // a named pipe. + ev.data >>= 1; + events.push(ev); + } } }