mirror of
https://github.com/ouch-org/ouch.git
synced 2025-06-07 03:55:28 +00:00
oof: remove unnecessary closures (((and undo last commit)))
This commit is contained in:
parent
e7eb55a4cf
commit
5ca99c101e
@ -127,9 +127,9 @@ pub fn filter_flags(
|
||||
// Safety: this loop only runs when len >= 1, so this subtraction is safe
|
||||
let is_last_letter = i == letters.len() - 1;
|
||||
|
||||
let flag_info = short_flags_info.get(&letter).ok_or_else(|| {
|
||||
let flag_info = short_flags_info.get(&letter).ok_or(
|
||||
OofError::UnknownShortFlag(letter)
|
||||
})?;
|
||||
)?;
|
||||
|
||||
if !is_last_letter && flag_info.takes_value {
|
||||
return Err(OofError::MisplacedShortArgFlagError(letter))
|
||||
@ -147,9 +147,9 @@ pub fn filter_flags(
|
||||
}
|
||||
|
||||
// pop the next one
|
||||
let flag_argument = iter.next().ok_or_else(|| {
|
||||
let flag_argument = iter.next().ok_or(
|
||||
OofError::MissingValueToFlag(flag_info)
|
||||
})?;
|
||||
)?;
|
||||
|
||||
// Otherwise, insert it.
|
||||
result_flags.argument_flags.insert(flag_name, flag_argument);
|
||||
@ -179,9 +179,9 @@ pub fn filter_flags(
|
||||
return Err(OofError::DuplicatedFlag(flag_info));
|
||||
}
|
||||
|
||||
let flag_argument = iter.next().ok_or_else(|| {
|
||||
let flag_argument = iter.next().ok_or(
|
||||
OofError::MissingValueToFlag(flag_info)
|
||||
})?;
|
||||
)?;
|
||||
result_flags.argument_flags.insert(flag_name, flag_argument);
|
||||
} else {
|
||||
// If it was already inserted
|
||||
|
@ -20,6 +20,7 @@ where
|
||||
let _ = paths
|
||||
.iter()
|
||||
.map(make_dummy_file)
|
||||
.map(Result::unwrap)
|
||||
.collect::<Vec<_>>();
|
||||
Ok(())
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user