mirror of
https://github.com/ouch-org/ouch.git
synced 2025-06-07 12:05:46 +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
|
// Safety: this loop only runs when len >= 1, so this subtraction is safe
|
||||||
let is_last_letter = i == letters.len() - 1;
|
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)
|
OofError::UnknownShortFlag(letter)
|
||||||
})?;
|
)?;
|
||||||
|
|
||||||
if !is_last_letter && flag_info.takes_value {
|
if !is_last_letter && flag_info.takes_value {
|
||||||
return Err(OofError::MisplacedShortArgFlagError(letter))
|
return Err(OofError::MisplacedShortArgFlagError(letter))
|
||||||
@ -147,9 +147,9 @@ pub fn filter_flags(
|
|||||||
}
|
}
|
||||||
|
|
||||||
// pop the next one
|
// pop the next one
|
||||||
let flag_argument = iter.next().ok_or_else(|| {
|
let flag_argument = iter.next().ok_or(
|
||||||
OofError::MissingValueToFlag(flag_info)
|
OofError::MissingValueToFlag(flag_info)
|
||||||
})?;
|
)?;
|
||||||
|
|
||||||
// Otherwise, insert it.
|
// Otherwise, insert it.
|
||||||
result_flags.argument_flags.insert(flag_name, flag_argument);
|
result_flags.argument_flags.insert(flag_name, flag_argument);
|
||||||
@ -179,9 +179,9 @@ pub fn filter_flags(
|
|||||||
return Err(OofError::DuplicatedFlag(flag_info));
|
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)
|
OofError::MissingValueToFlag(flag_info)
|
||||||
})?;
|
)?;
|
||||||
result_flags.argument_flags.insert(flag_name, flag_argument);
|
result_flags.argument_flags.insert(flag_name, flag_argument);
|
||||||
} else {
|
} else {
|
||||||
// If it was already inserted
|
// If it was already inserted
|
||||||
|
@ -20,6 +20,7 @@ where
|
|||||||
let _ = paths
|
let _ = paths
|
||||||
.iter()
|
.iter()
|
||||||
.map(make_dummy_file)
|
.map(make_dummy_file)
|
||||||
|
.map(Result::unwrap)
|
||||||
.collect::<Vec<_>>();
|
.collect::<Vec<_>>();
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user