fix(status-area): break from loop instead of unwrapping
This commit is contained in:
parent
79621c1955
commit
bd0d180482
1 changed files with 11 additions and 4 deletions
|
|
@ -5,6 +5,7 @@
|
|||
// but only tracking unique names, and using tokio executor.
|
||||
|
||||
use futures::StreamExt;
|
||||
use futures::stream::FusedStream;
|
||||
use std::{
|
||||
collections::HashSet,
|
||||
future::{Future, poll_fn},
|
||||
|
|
@ -36,9 +37,15 @@ impl Inner {
|
|||
/// Process all events so far on `stream`, and update `unique_names`.
|
||||
fn update_if_needed(&mut self) {
|
||||
let mut context = Context::from_waker(&self.waker);
|
||||
while let Poll::Ready(val) = self.stream.poll_next_unpin(&mut context) {
|
||||
let val = val.unwrap();
|
||||
let args = val.args().unwrap();
|
||||
while !self.stream.is_terminated()
|
||||
&& let Poll::Ready(val) = self.stream.poll_next_unpin(&mut context)
|
||||
{
|
||||
let Some(val) = val else {
|
||||
break;
|
||||
};
|
||||
let Ok(args) = val.args() else {
|
||||
break;
|
||||
};
|
||||
match args.name {
|
||||
BusName::Unique(name) => {
|
||||
if args.new_owner.is_some() {
|
||||
|
|
@ -48,7 +55,7 @@ impl Inner {
|
|||
}
|
||||
}
|
||||
BusName::WellKnown(_) => {}
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue