Use while let

When destructuring a single pattern in a loop it is nicer to use while let.

Fixes https://github.com/sdroege/gstreamer-rs/pull/46
Fixes https://github.com/sdroege/gstreamer-rs/issues/45
This commit is contained in:
Luis de Bethencourt 2017-10-22 14:01:29 +01:00 committed by Sebastian Dröge
parent 342d89dd44
commit 95dc336b65

View file

@ -119,11 +119,7 @@ fn main() {
// Wait until error, EOS or State Change // Wait until error, EOS or State Change
let bus = pipeline.get_bus().unwrap(); let bus = pipeline.get_bus().unwrap();
loop { while let Some(msg) = bus.timed_pop(gst::CLOCK_TIME_NONE) {
let msg = bus.timed_pop(gst::CLOCK_TIME_NONE);
match msg {
Some(msg) => {
match msg.view() { match msg.view() {
MessageView::Error(err) => { MessageView::Error(err) => {
println!( println!(
@ -154,9 +150,6 @@ fn main() {
_ => (), _ => (),
} }
} }
None => (),
}
}
// Shutdown pipeline // Shutdown pipeline
let ret = pipeline.set_state(gst::State::Null); let ret = pipeline.set_state(gst::State::Null);