mirror of
https://github.com/eza-community/eza.git
synced 2025-12-23 05:36:50 +00:00
style: fix treefmt issues in options module
Signed-off-by: Sandro-Alessio Gierens <sandro@gierens.de>
This commit is contained in:
parent
8a8f8ee907
commit
201abcccf3
2 changed files with 14 additions and 4 deletions
|
|
@ -40,10 +40,14 @@ impl SortField {
|
|||
/// Returns the default sort field if none is given, or `Err` if the
|
||||
/// value doesn’t correspond to a sort field we know about.
|
||||
fn deduce(matches: &MatchedFlags<'_>) -> Result<Self, OptionsError> {
|
||||
let Some(word) = matches.get(&flags::SORT)? else { return Ok(Self::default()) };
|
||||
let Some(word) = matches.get(&flags::SORT)? else {
|
||||
return Ok(Self::default());
|
||||
};
|
||||
|
||||
// Get String because we can’t match an OsStr
|
||||
let Some(word) = word.to_str() else { return Err(OptionsError::BadArgument(&flags::SORT, word.into())) };
|
||||
let Some(word) = word.to_str() else {
|
||||
return Err(OptionsError::BadArgument(&flags::SORT, word.into()));
|
||||
};
|
||||
|
||||
let field = match word {
|
||||
"name" | "filename" => Self::Name(SortCase::AaBbCc),
|
||||
|
|
@ -160,7 +164,9 @@ impl IgnorePatterns {
|
|||
pub fn deduce(matches: &MatchedFlags<'_>) -> Result<Self, OptionsError> {
|
||||
// If there are no inputs, we return a set of patterns that doesn’t
|
||||
// match anything, rather than, say, `None`.
|
||||
let Some(inputs) = matches.get(&flags::IGNORE_GLOB)? else { return Ok(Self::empty()) };
|
||||
let Some(inputs) = matches.get(&flags::IGNORE_GLOB)? else {
|
||||
return Ok(Self::empty());
|
||||
};
|
||||
|
||||
// Awkwardly, though, a glob pattern can be invalid, and we need to
|
||||
// deal with invalid patterns somehow.
|
||||
|
|
|
|||
|
|
@ -28,7 +28,11 @@ impl UseColours {
|
|||
None => Self::Automatic,
|
||||
};
|
||||
|
||||
let Some(word) = matches.get_where(|f| f.matches(&flags::COLOR) || f.matches(&flags::COLOUR))? else { return Ok(default_value) };
|
||||
let Some(word) =
|
||||
matches.get_where(|f| f.matches(&flags::COLOR) || f.matches(&flags::COLOUR))?
|
||||
else {
|
||||
return Ok(default_value);
|
||||
};
|
||||
|
||||
if word == "always" {
|
||||
Ok(Self::Always)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue