cmp.rs: simplify by .ok_or

This commit is contained in:
oech3
2026-06-10 02:30:50 +09:00
committed by Daniel Hofstetter
parent a46dae68b1
commit f29e96cdba
+1 -3
View File
@@ -71,9 +71,7 @@ fn is_stdout_dev_null() -> bool {
}
pub fn parse_params<I: Iterator<Item = OsString>>(mut opts: Peekable<I>) -> Result<Params, String> {
let Some(executable) = opts.next() else {
return Err("Usage: <exe> <from> <to>".to_string());
};
let executable = opts.next().ok_or("Usage: <exe> <from> <to>".to_string())?;
let executable_str = executable.to_string_lossy().to_string();
let parse_skip = |param: &str, skip_desc: &str| -> Result<SkipU64, String> {