Skip to content
Myr

filetypes.rs

This file

Path

src/filetypes.rs

39 lines · 1.3 KiB · Rust

Last changed by

send DirEntries to output instead of just pathJonathan Gorenbefore adoption813a802

History of this file

Take it

The walk stopped after 200 commits: lines older than bbf3d0d point at it.

send DirEntries to output instead of just pathJonathan Gorenbefore adoption813a802

line 1why, one step back
1use crate::entry;

Refactor file types check to be on impl of FileTypesThayne McCombsbefore adoption115ae93

lines 2–3why, one step back
2use crate::filesystem;
3

Update testenv to support errors that don't failDJRHailsbefore adoptionbbf3d0d

line 4why, one step back
4/// Whether or not to show

A couple of minor recommendations from the Code Quality action (#903)Thayne McCombsbefore adoption5ea7cb7

line 5why, one step back
5#[derive(Default)]

Update testenv to support errors that don't failDJRHailsbefore adoptionbbf3d0d

lines 6–15why, one step back
6pub struct FileTypes {
7 pub files: bool,8 pub directories: bool,9 pub symlinks: bool,10 pub sockets: bool,11 pub pipes: bool,12 pub executables_only: bool,13 pub empty_only: bool,14}15

Refactor file types check to be on impl of FileTypesThayne McCombsbefore adoption115ae93

line 16why, one step back
16impl FileTypes {

send DirEntries to output instead of just pathJonathan Gorenbefore adoption813a802

line 17why, one step back
17 pub fn should_ignore(&self, entry: &entry::DirEntry) -> bool {

Refactor file types check to be on impl of FileTypesThayne McCombsbefore adoption115ae93

lines 18–26why, one step back
18 if let Some(ref entry_type) = entry.file_type() {
19 (!self.files && entry_type.is_file())20 || (!self.directories && entry_type.is_dir())21 || (!self.symlinks && entry_type.is_symlink())22 || (!self.sockets && filesystem::is_socket(*entry_type))23 || (!self.pipes && filesystem::is_pipe(*entry_type))24 || (self.executables_only25 && !entry26 .metadata()

A couple of minor recommendations from the Code Quality action (#903)Thayne McCombsbefore adoption5ea7cb7

line 27why, one step back
27 .map(filesystem::is_executable)

Refactor file types check to be on impl of FileTypesThayne McCombsbefore adoption115ae93

line 28why, one step back
28 .unwrap_or(false))

Remove an unnecessary reference. (#864)Thayne McCombsbefore adoption00eb646

line 29why, one step back
29 || (self.empty_only && !filesystem::is_empty(entry))

Refactor file types check to be on impl of FileTypesThayne McCombsbefore adoption115ae93

lines 30–36why, one step back
30 || !(entry_type.is_file()
31 || entry_type.is_dir()32 || entry_type.is_symlink()33 || filesystem::is_socket(*entry_type)34 || filesystem::is_pipe(*entry_type))35 } else {36 true

Update testenv to support errors that don't failDJRHailsbefore adoptionbbf3d0d

lines 37–39why, one step back
37 }
38 }39}