From 2a66fbab2866fd149d87c2c26a0cae36619c0e7a Mon Sep 17 00:00:00 2001 From: Thayne McCombs Date: Tue, 28 Jan 2025 01:35:00 -0700 Subject: [PATCH 1/2] docs: Mention --full-path in troubleshooting See: #1662 --- README.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/README.md b/README.md index 1fe42b8e3..c9608f845 100644 --- a/README.md +++ b/README.md @@ -388,6 +388,11 @@ use the options `-u`/`--unrestricted` option (or `-HI` to enable hidden and igno > fd -u … ``` +Also remember that by default, `fd` only searches based on the filename and +doesn't compare the pattern to the full path. If you want to search based on the +full path (similar to the `-path` option of `find`) you need to use the `--full-path` +(or `-p`) option. + ### Colorized output `fd` can colorize files by extension, just like `ls`. In order for this to work, the environment From 8c177567a770f5048b6b2cf285687cc402293072 Mon Sep 17 00:00:00 2001 From: Thayne McCombs Date: Tue, 28 Jan 2025 01:55:21 -0700 Subject: [PATCH 2/2] chore: Fix clippy lints Use is_some_and instead of map_or(false --- src/output.rs | 2 +- src/walk.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/output.rs b/src/output.rs index 1d53c55f5..facebc77e 100644 --- a/src/output.rs +++ b/src/output.rs @@ -51,7 +51,7 @@ fn print_trailing_slash( config: &Config, style: Option<&Style>, ) -> io::Result<()> { - if entry.file_type().map_or(false, |ft| ft.is_dir()) { + if entry.file_type().is_some_and(|ft| ft.is_dir()) { write!( stdout, "{}", diff --git a/src/walk.rs b/src/walk.rs index a98bdffd0..0991e1c73 100644 --- a/src/walk.rs +++ b/src/walk.rs @@ -477,7 +477,7 @@ impl WorkerState { && path .symlink_metadata() .ok() - .map_or(false, |m| m.file_type().is_symlink()) => + .is_some_and(|m| m.file_type().is_symlink()) => { DirEntry::broken_symlink(path) }