mirror of
https://github.com/sharkdp/fd.git
synced 2026-08-31 01:15:43 +08:00
cargo fmt
This commit is contained in:
+1
-4
@@ -529,10 +529,7 @@ pub struct Opts {
|
||||
pub hyperlink: HyperlinkWhen,
|
||||
|
||||
/// Ignore directories containing the named entry.
|
||||
#[arg(
|
||||
long,
|
||||
value_name = "name"
|
||||
)]
|
||||
#[arg(long, value_name = "name")]
|
||||
pub ignore_contain: Vec<String>,
|
||||
|
||||
/// Set number of threads to use for searching & executing (default: number
|
||||
|
||||
+4
-1
@@ -503,7 +503,10 @@ impl WorkerState {
|
||||
|
||||
// Filter out directories containing a given name.
|
||||
if entry_path.is_dir()
|
||||
&& config.ignore_contain.iter().any(|ic| entry_path.join(ic).exists())
|
||||
&& config
|
||||
.ignore_contain
|
||||
.iter()
|
||||
.any(|ic| entry_path.join(ic).exists())
|
||||
{
|
||||
return WalkState::Skip;
|
||||
}
|
||||
|
||||
+12
-2
@@ -2724,7 +2724,14 @@ fn test_ignore_contain() {
|
||||
include/foo
|
||||
symlink
|
||||
top";
|
||||
te.assert_output(&["--ignore-contain=CACHEDIR.TAG", "--ignore-contain=ignoremyparent", "."], expected);
|
||||
te.assert_output(
|
||||
&[
|
||||
"--ignore-contain=CACHEDIR.TAG",
|
||||
"--ignore-contain=ignoremyparent",
|
||||
".",
|
||||
],
|
||||
expected,
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -2739,5 +2746,8 @@ fn test_ignore_contain_has_highest_precedence() {
|
||||
],
|
||||
);
|
||||
let expected = "include/foo";
|
||||
te.assert_output(&["--ignore-contain=CACHEDIR.TAG", "--min-depth=2", "."], expected);
|
||||
te.assert_output(
|
||||
&["--ignore-contain=CACHEDIR.TAG", "--min-depth=2", "."],
|
||||
expected,
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user