diff --git a/README.md b/README.md index 6c36c1e..47efe56 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,7 @@ [![Build Status](https://travis-ci.org/sharkdp/fd.svg?branch=master)](https://travis-ci.org/sharkdp/fd) [![Build status](https://ci.appveyor.com/api/projects/status/21c4p5fwggc5gy3j?svg=true)](https://ci.appveyor.com/project/sharkdp/fd) [![Version info](https://img.shields.io/crates/v/fd-find.svg)](https://crates.io/crates/fd-find) +[中文](https://github.com/chinanf-boy/fd-zh) *fd* is a simple, fast and user-friendly alternative to [*find*](https://www.gnu.org/software/findutils/). diff --git a/src/internal/filter/time.rs b/src/internal/filter/time.rs index 5102598..413ba8f 100644 --- a/src/internal/filter/time.rs +++ b/src/internal/filter/time.rs @@ -42,61 +42,41 @@ mod tests { use humantime; let ref_time = humantime::parse_rfc3339("2010-10-10T10:10:10Z").unwrap(); - assert!( - TimeFilter::after(&ref_time, "1min") - .unwrap() - .applies_to(&ref_time) - ); - assert!( - !TimeFilter::before(&ref_time, "1min") - .unwrap() - .applies_to(&ref_time) - ); + assert!(TimeFilter::after(&ref_time, "1min") + .unwrap() + .applies_to(&ref_time)); + assert!(!TimeFilter::before(&ref_time, "1min") + .unwrap() + .applies_to(&ref_time)); let t1m_ago = ref_time - Duration::from_secs(60); - assert!( - !TimeFilter::after(&ref_time, "30sec") - .unwrap() - .applies_to(&t1m_ago) - ); - assert!( - TimeFilter::after(&ref_time, "2min") - .unwrap() - .applies_to(&t1m_ago) - ); + assert!(!TimeFilter::after(&ref_time, "30sec") + .unwrap() + .applies_to(&t1m_ago)); + assert!(TimeFilter::after(&ref_time, "2min") + .unwrap() + .applies_to(&t1m_ago)); - assert!( - TimeFilter::before(&ref_time, "30sec") - .unwrap() - .applies_to(&t1m_ago) - ); - assert!( - !TimeFilter::before(&ref_time, "2min") - .unwrap() - .applies_to(&t1m_ago) - ); + assert!(TimeFilter::before(&ref_time, "30sec") + .unwrap() + .applies_to(&t1m_ago)); + assert!(!TimeFilter::before(&ref_time, "2min") + .unwrap() + .applies_to(&t1m_ago)); let t10s_before = "2010-10-10 10:10:00"; - assert!( - !TimeFilter::before(&ref_time, t10s_before) - .unwrap() - .applies_to(&ref_time) - ); - assert!( - TimeFilter::before(&ref_time, t10s_before) - .unwrap() - .applies_to(&t1m_ago) - ); + assert!(!TimeFilter::before(&ref_time, t10s_before) + .unwrap() + .applies_to(&ref_time)); + assert!(TimeFilter::before(&ref_time, t10s_before) + .unwrap() + .applies_to(&t1m_ago)); - assert!( - TimeFilter::after(&ref_time, t10s_before) - .unwrap() - .applies_to(&ref_time) - ); - assert!( - !TimeFilter::after(&ref_time, t10s_before) - .unwrap() - .applies_to(&t1m_ago) - ); + assert!(TimeFilter::after(&ref_time, t10s_before) + .unwrap() + .applies_to(&ref_time)); + assert!(!TimeFilter::after(&ref_time, t10s_before) + .unwrap() + .applies_to(&t1m_ago)); } } diff --git a/src/walk.rs b/src/walk.rs index 46af5c5..7aaa4c7 100644 --- a/src/walk.rs +++ b/src/walk.rs @@ -240,10 +240,11 @@ pub fn scan(path_vec: &[PathBuf], pattern: Arc, config: Arc) { if (!file_types.files && entry_type.is_file()) || (!file_types.directories && entry_type.is_dir()) || (!file_types.symlinks && entry_type.is_symlink()) - || (file_types.executables_only && !entry - .metadata() - .map(|m| fshelper::is_executable(&m)) - .unwrap_or(false)) + || (file_types.executables_only + && !entry + .metadata() + .map(|m| fshelper::is_executable(&m)) + .unwrap_or(false)) || (file_types.empty_only && !fshelper::is_empty(&entry)) { return ignore::WalkState::Continue;