Minor style changes
Before adoption: this commit came in with the history the project adopted, so no landing records it.
authored by sharkdp · committed by sharkdp · parent 2a3dd5b · Browse files · 3 files·+21 added−20 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
3 files+21 added−20 removed
- other:+21 added−20 removed
Provenance
- Commit
c1b8d1e- Tree
a6c139f- Author
sharkdp <davidpeter@web.de>- Committer
sharkdp <davidpeter@web.de>- Parent
2a3dd5b
3 files changed+21 added−20 removed
modified:src/main.rs+19 added-18 removed
38 unmodified lines39 /// As a relative path40 Relative41 }42 43+/// The type of file to search for.44+#[derive(Copy, Clone)]45+enum FileType {46+ Any,47+ RegularFile,48+ Directory,49+ SymLink50+}51+52 /// Configuration options for *fd*.53 struct FdOptions {54 /// Determines whether the regex search is case-sensitive or case-insensitive.55 case_sensitive: bool,34 unmodified lines90 /// `None` if the output should not be colorized. Otherwise, a `LsColors` instance that defines91 /// how to style different filetypes.92 ls_colors: Option<LsColors>,93 94+ /// The type of file to search for. All files other than the specified type will be ignored.95 file_type: FileType,96 }97 88-/// The type of file to search for. All files other than the specified type will be ignored.89-#[derive(Copy, Clone)]90-enum FileType {91- Any,92- RegularFile,93- Directory,94- SymLink,95-}96-98 /// The receiver thread can either be buffering results or directly streaming to the console.99 enum ReceiverMode {100 /// Receiver is still buffering in order to sort the results, if the search finishes fast101 /// enough.187 unmodified lines289 // Filter out unwanted file types.290 match config.file_type {291 FileType::Any => (),292 FileType::RegularFile => if entry.file_type().map_or(false, |ft| !ft.is_file()) {292- return ignore::WalkState::Continue;293+ return ignore::WalkState::Continue;294 },295 FileType::Directory => if entry.file_type().map_or(false, |ft| !ft.is_dir()) {295- return ignore::WalkState::Continue;296+ return ignore::WalkState::Continue;297 },298 FileType::SymLink => if entry.file_type().map_or(false, |ft| !ft.is_symlink()) {298- return ignore::WalkState::Continue;299+ return ignore::WalkState::Continue;300 },301 }302 303 let path_rel_buf = match fshelper::path_relative_from(entry.path(), &*base) {176 unmodified lines480 } else {481 PathDisplay::Relative482 },483 ls_colors: ls_colors,483- file_type: match matches.value_of("file-type") {484- Some("f") | Some("file") => FileType::RegularFile,485- Some("d") | Some("directory") => FileType::Directory,486- Some("s") | Some("symlink") => FileType::SymLink,487- _ => FileType::Any,488- },484+ file_type: match matches.value_of("file-type") {485+ Some("f") | Some("file") => FileType::RegularFile,486+ Some("d") | Some("directory") => FileType::Directory,487+ Some("s") | Some("symlink") => FileType::SymLink,488+ _ => FileType::Any,489+ },490 };491 492 let root = Path::new(ROOT_DIR);493 let base = match config.path_display {11 unmodified linesmodified:Cargo.lock+1 added-1 removed
1 [root]2 name = "fd-find"3-version = "3.0.0"3+version = "3.1.0"4 dependencies = [5 "ansi_term 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",6 "atty 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",7 "clap 2.26.0 (registry+https://github.com/rust-lang/crates.io-index)",270 unmodified linesmodified:Cargo.toml+1 added-1 removed
1233456717 unmodified lines[package]name = "fd-find"version = "3.0.0"version = "3.1.0"authors = ["David Peter <mail@david-peter.de>"]description = "fd is a simple, fast and user-friendly alternative to find."homepage = "https://github.com/sharkdp/fd"repository = "https://github.com/sharkdp/fd"17 unmodified lines