oof: remove unnecessary closures (((and undo last commit)))

This commit is contained in:
Vinícius Miguel 2021-04-08 03:03:07 -03:00
parent e7eb55a4cf
commit 5ca99c101e
2 changed files with 7 additions and 6 deletions

View File

@ -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

View File

@ -20,6 +20,7 @@ where
let _ = paths
.iter()
.map(make_dummy_file)
.map(Result::unwrap)
.collect::<Vec<_>>();
Ok(())
}