Просмотр исходного кода

style: fix treefmt issues in options module

Signed-off-by: Sandro-Alessio Gierens <sandro@gierens.de>
Sandro-Alessio Gierens 2 лет назад
Родитель
Сommit
201abcccf3
2 измененных файлов с 14 добавлено и 4 удалено
  1. 9 3
      src/options/filter.rs
  2. 5 1
      src/options/theme.rs

+ 9 - 3
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<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.

+ 5 - 1
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)