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
let bus = pipeline.get_bus().unwrap();
loop {
let msg = bus.timed_pop(gst::CLOCK_TIME_NONE);
match msg {
Some(msg) => {
while let Some(msg) = bus.timed_pop(gst::CLOCK_TIME_NONE) {
match msg.view() {
MessageView::Error(err) => {
println!(
@ -154,9 +150,6 @@ fn main() {
_ => (),
}
}
None => (),
}
}
// Shutdown pipeline
let ret = pipeline.set_state(gst::State::Null);