From 201abcccf34dcbdd2d71e27707117e55991c14ab Mon Sep 17 00:00:00 2001 From: Sandro-Alessio Gierens Date: Sat, 23 Sep 2023 18:38:51 +0200 Subject: [PATCH] style: fix treefmt issues in options module Signed-off-by: Sandro-Alessio Gierens --- src/options/filter.rs | 12 +++++++++--- src/options/theme.rs | 6 +++++- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/src/options/filter.rs b/src/options/filter.rs index 16d5127e..d07c1a96 100644 --- a/src/options/filter.rs +++ b/src/options/filter.rs @@ -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 { - 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 { // 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. diff --git a/src/options/theme.rs b/src/options/theme.rs index 11276b75..13422782 100644 --- a/src/options/theme.rs +++ b/src/options/theme.rs @@ -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)