diff options
Diffstat (limited to 'src/backends/zenity.rs')
-rw-r--r-- | src/backends/zenity.rs | 34 |
1 files changed, 15 insertions, 19 deletions
diff --git a/src/backends/zenity.rs b/src/backends/zenity.rs index 85206b3..12e052b 100644 --- a/src/backends/zenity.rs +++ b/src/backends/zenity.rs @@ -101,15 +101,13 @@ impl AsRef<Zenity> for Zenity { fn require_success(status: process::ExitStatus) -> Result<()> { if status.success() { Ok(()) - } else { - if let Some(code) = status.code() { - match code { - 5 => Ok(()), - _ => Err(Error::from(("zenity", status))), - } - } else { - Err(Error::from(("zenity", status))) + } else if let Some(code) = status.code() { + match code { + 5 => Ok(()), + _ => Err(Error::from(("zenity", status))), } + } else { + Err(Error::from(("zenity", status))) } } @@ -130,18 +128,16 @@ fn get_stdout(output: process::Output) -> Result<Option<String>> { if output.status.success() { String::from_utf8(output.stdout) .map(|s| Some(s.trim_end_matches('\n').to_string())) - .map_err(|err| Error::from(err)) - } else { - if let Some(code) = output.status.code() { - match code { - 0 => Ok(None), - 1 => Ok(None), - 5 => Ok(None), - _ => Err(Error::from(("zenity", output.status))), - } - } else { - Err(Error::from(("zenity", output.status))) + .map_err(Error::from) + } else if let Some(code) = output.status.code() { + match code { + 0 => Ok(None), + 1 => Ok(None), + 5 => Ok(None), + _ => Err(Error::from(("zenity", output.status))), } + } else { + Err(Error::from(("zenity", output.status))) } } |