From c5f430010e2b0ab10951f484d67915331aab20eb Mon Sep 17 00:00:00 2001 From: Alex Butler Date: Fri, 28 Jun 2024 01:13:48 +0100 Subject: [PATCH] Simplify !parsed_done err handling --- src/vmaf.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/vmaf.rs b/src/vmaf.rs index d12fb1e..5d1aa25 100644 --- a/src/vmaf.rs +++ b/src/vmaf.rs @@ -38,7 +38,6 @@ pub fn run( let mut vmaf = vmaf; let mut chunks = Chunks::default(); let mut parsed_done = false; - let mut exit_ok = false; while let Some(next) = vmaf.next().await { match next { Item::Stderr(chunk) => { @@ -50,13 +49,14 @@ pub fn run( } } Item::Stdout(_) => {} - Item::Done(code) => match exit_ok_stderr("ffmpeg vmaf", code, &cmd_str, &chunks) { - Ok(_) => exit_ok = true, - Err(err) => yield VmafOut::Err(err), - }, + Item::Done(code) => { + if let Err(err) = exit_ok_stderr("ffmpeg vmaf", code, &cmd_str, &chunks) { + yield VmafOut::Err(err); + } + } } } - if exit_ok && !parsed_done { + if !parsed_done { yield VmafOut::Err(cmd_err( "could not parse ffmpeg vmaf score", &cmd_str,