Skip to content

Commit f29e96c

Browse files
oech3cakebaker
authored andcommitted
cmp.rs: simplify by .ok_or
1 parent a46dae6 commit f29e96c

1 file changed

Lines changed: 1 addition & 3 deletions

File tree

src/cmp.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,7 @@ fn is_stdout_dev_null() -> bool {
7171
}
7272

7373
pub fn parse_params<I: Iterator<Item = OsString>>(mut opts: Peekable<I>) -> Result<Params, String> {
74-
let Some(executable) = opts.next() else {
75-
return Err("Usage: <exe> <from> <to>".to_string());
76-
};
74+
let executable = opts.next().ok_or("Usage: <exe> <from> <to>".to_string())?;
7775
let executable_str = executable.to_string_lossy().to_string();
7876

7977
let parse_skip = |param: &str, skip_desc: &str| -> Result<SkipU64, String> {

0 commit comments

Comments
 (0)