fix(status-area): break from loop instead of unwrapping

This commit is contained in:
Ashley Wulber 2026-03-19 10:43:24 -04:00 committed by Ashley Wulber
parent 79621c1955
commit bd0d180482

View file

@ -5,6 +5,7 @@
// but only tracking unique names, and using tokio executor. // but only tracking unique names, and using tokio executor.
use futures::StreamExt; use futures::StreamExt;
use futures::stream::FusedStream;
use std::{ use std::{
collections::HashSet, collections::HashSet,
future::{Future, poll_fn}, future::{Future, poll_fn},
@ -36,9 +37,15 @@ impl Inner {
/// Process all events so far on `stream`, and update `unique_names`. /// Process all events so far on `stream`, and update `unique_names`.
fn update_if_needed(&mut self) { fn update_if_needed(&mut self) {
let mut context = Context::from_waker(&self.waker); let mut context = Context::from_waker(&self.waker);
while let Poll::Ready(val) = self.stream.poll_next_unpin(&mut context) { while !self.stream.is_terminated()
let val = val.unwrap(); && let Poll::Ready(val) = self.stream.poll_next_unpin(&mut context)
let args = val.args().unwrap(); {
let Some(val) = val else {
break;
};
let Ok(args) = val.args() else {
break;
};
match args.name { match args.name {
BusName::Unique(name) => { BusName::Unique(name) => {
if args.new_owner.is_some() { if args.new_owner.is_some() {
@ -48,7 +55,7 @@ impl Inner {
} }
} }
BusName::WellKnown(_) => {} BusName::WellKnown(_) => {}
} };
} }
} }
} }