소스 검색

style: reapply rustfmt after rebase from main

Signed-off-by: Sandro-Alessio Gierens <sandro@gierens.de>
Sandro-Alessio Gierens 2 년 전
부모
커밋
c43de99fdb
7개의 변경된 파일50개의 추가작업 그리고 35개의 파일을 삭제
  1. 20 7
      src/fs/feature/git.rs
  2. 5 5
      src/fs/fields.rs
  3. 5 3
      src/fs/filter.rs
  4. 5 3
      src/options/filter.rs
  5. 8 4
      src/output/render/git.rs
  6. 3 9
      src/output/table.rs
  7. 4 4
      src/theme/ui_styles.rs

+ 20 - 7
src/fs/feature/git.rs

@@ -402,21 +402,30 @@ fn current_branch(repo: &git2::Repository) -> Option<String> {
     None
 }
 
-impl f::SubdirGitRepo{
-    pub fn from_path(dir : &Path, status : bool) -> Self{
+impl f::SubdirGitRepo {
+    pub fn from_path(dir: &Path, status: bool) -> Self {
         let path = &reorient(dir);
 
         if let Ok(repo) = git2::Repository::open(path) {
             let branch = current_branch(&repo);
-            if !status{
-                return Self{ status: None, branch };
+            if !status {
+                return Self {
+                    status: None,
+                    branch,
+                };
             }
             match repo.statuses(None) {
                 Ok(es) => {
                     if es.iter().any(|s| s.status() != git2::Status::IGNORED) {
-                        return Self { status: Some(f::SubdirGitRepoStatus::GitDirty), branch };
+                        return Self {
+                            status: Some(f::SubdirGitRepoStatus::GitDirty),
+                            branch,
+                        };
                     }
-                    return Self { status: Some(f::SubdirGitRepoStatus::GitClean), branch };
+                    return Self {
+                        status: Some(f::SubdirGitRepoStatus::GitClean),
+                        branch,
+                    };
                 }
                 Err(e) => {
                     error!("Error looking up Git statuses: {e:?}");
@@ -424,7 +433,11 @@ impl f::SubdirGitRepo{
             }
         }
         f::SubdirGitRepo {
-            status: if status { Some(f::SubdirGitRepoStatus::NoRepo) } else { None },
+            status: if status {
+                Some(f::SubdirGitRepoStatus::NoRepo)
+            } else {
+                None
+            },
             branch: None,
         }
     }

+ 5 - 5
src/fs/fields.rs

@@ -261,16 +261,16 @@ pub enum SubdirGitRepoStatus {
 }
 
 #[derive(Clone)]
-pub struct SubdirGitRepo{
-    pub status : Option<SubdirGitRepoStatus>,
-    pub branch : Option<String>
+pub struct SubdirGitRepo {
+    pub status: Option<SubdirGitRepoStatus>,
+    pub branch: Option<String>,
 }
 
 impl Default for SubdirGitRepo {
     fn default() -> Self {
-        Self{
+        Self {
             status: Some(SubdirGitRepoStatus::NoRepo),
-            branch: None
+            branch: None,
         }
     }
 }

+ 5 - 3
src/fs/filter.rs

@@ -8,7 +8,6 @@ use std::os::unix::fs::MetadataExt;
 use crate::fs::DotFilter;
 use crate::fs::File;
 
-
 /// Flags used to manage the **file filter** process
 #[derive(PartialEq, Eq, Debug, Clone)]
 pub enum FileFilterFlags {
@@ -21,7 +20,7 @@ pub enum FileFilterFlags {
     OnlyDirs,
 
     /// Whether to only show files.
-    OnlyFiles
+    OnlyFiles,
 }
 
 /// The **file filter** processes a list of files before displaying them to
@@ -79,7 +78,10 @@ impl FileFilter {
 
         files.retain(|f| !self.ignore_patterns.is_ignored(&f.name));
 
-        match (self.flags.contains(&OnlyDirs), self.flags.contains(&OnlyFiles)) {
+        match (
+            self.flags.contains(&OnlyDirs),
+            self.flags.contains(&OnlyFiles),
+        ) {
             (true, false) => {
                 // On pass -'-only-dirs' flag only
                 files.retain(File::is_directory);

+ 5 - 3
src/options/filter.rs

@@ -1,6 +1,8 @@
 //! Parsing the options for `FileFilter`.
 
-use crate::fs::filter::{FileFilter, FileFilterFlags, GitIgnore, IgnorePatterns, SortCase, SortField};
+use crate::fs::filter::{
+    FileFilter, FileFilterFlags, GitIgnore, IgnorePatterns, SortCase, SortField,
+};
 use crate::fs::DotFilter;
 
 use crate::options::parser::MatchedFlags;
@@ -10,9 +12,9 @@ impl FileFilter {
     /// Determines which of all the file filter options to use.
     pub fn deduce(matches: &MatchedFlags<'_>) -> Result<Self, OptionsError> {
         use FileFilterFlags as FFF;
-        let mut filter_flags:Vec<FileFilterFlags> = vec![];
+        let mut filter_flags: Vec<FileFilterFlags> = vec![];
 
-        for (has,flag) in &[
+        for (has, flag) in &[
             (matches.has(&flags::REVERSE)?, FFF::Reverse),
             (matches.has(&flags::ONLY_DIRS)?, FFF::OnlyDirs),
             (matches.has(&flags::ONLY_FILES)?, FFF::OnlyFiles),

+ 8 - 4
src/output/render/git.rs

@@ -46,9 +46,12 @@ impl f::SubdirGitRepo {
     pub fn render(self, colours: &dyn RepoColours) -> TextCell {
         let branch_name = match self.branch {
             Some(name) => {
-                if name == "main" || name == "master" { colours.branch_main().paint(name) }
-                else { colours.branch_other().paint(name) }
-            },
+                if name == "main" || name == "master" {
+                    colours.branch_main().paint(name)
+                } else {
+                    colours.branch_other().paint(name)
+                }
+            }
             None => colours.no_repo().paint("-"),
         };
 
@@ -59,7 +62,8 @@ impl f::SubdirGitRepo {
                     status.render(colours),
                     Style::default().paint(" "),
                     branch_name,
-                ].into(),
+                ]
+                .into(),
             }
         } else {
             TextCell {

+ 3 - 9
src/output/table.rs

@@ -462,15 +462,9 @@ impl<'a> Table<'a> {
                     .render(self.theme, &*self.env.lock_users(), self.user_format)
             }
             #[cfg(unix)]
-            Column::SecurityContext => {
-                file.security_context().render(self.theme)
-            }
-            Column::GitStatus => {
-                self.git_status(file).render(self.theme)
-            }
-            Column::SubdirGitRepo(status) => {
-                self.subdir_git_repo(file, status).render(self.theme)
-            }
+            Column::SecurityContext => file.security_context().render(self.theme),
+            Column::GitStatus => self.git_status(file).render(self.theme),
+            Column::SubdirGitRepo(status) => self.subdir_git_repo(file, status).render(self.theme),
             #[cfg(unix)]
             Column::Octal => self.octal_permissions(file).render(self.theme.ui.octal),
 

+ 4 - 4
src/theme/ui_styles.rs

@@ -126,10 +126,10 @@ pub struct GitRepo {
 #[derive(Clone, Copy, Debug, Default, PartialEq)]
 pub struct SELinuxContext {
     pub colon: Style,
-    pub user:  Style,  // Su
-    pub role:  Style,  // Sr
-    pub typ:   Style,  // St
-    pub range: Style,  // Sl
+    pub user: Style,  // Su
+    pub role: Style,  // Sr
+    pub typ: Style,   // St
+    pub range: Style, // Sl
 }
 
 #[rustfmt::skip]