cargo fmt
Before adoption: this commit came in with the history the project adopted, so no landing records it.
authored by sharkdp · committed by sharkdp · parent 53226f8 · Browse files · 6 files·+50 added−25 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
6 files+50 added−25 removed
- tests:+6 added−3 removed
- other:+44 added−22 removed
Provenance
- Commit
27caa33- Tree
53c3cda- Author
sharkdp <davidpeter@web.de>- Committer
sharkdp <davidpeter@web.de>- Parent
53226f8
6 files changed+50 added−25 removed
modified:src/fshelper/mod.rs+2 added-1 removed
31 unmodified lines32 path_buf33 .as_path()34 .to_string_lossy()35 .trim_left_matches(r"\\?\"),36+ )36- ).to_path_buf();37+ .to_path_buf();38 39 Ok(path_buf)40 }41 37 unmodified linesmodified:src/app.rs+30 added-15 removed
48 unmodified lines49 arg("rg-alias-hidden-ignore")50 .short("u")51 .multiple(true)52 .hidden(true),53+ )53- ).arg(54+ .arg(55 arg("case-sensitive")56 .long("case-sensitive")57 .short("s")58 .overrides_with("ignore-case"),59+ )58- ).arg(60+ .arg(61 arg("ignore-case")62 .long("ignore-case")63 .short("i")64 .overrides_with("case-sensitive"),65+ )63- ).arg(66+ .arg(67 arg("fixed-strings")68 .long("fixed-strings")69 .short("F")70 .alias("literal"),71+ )68- ).arg(arg("absolute-path").long("absolute-path").short("a"))72+ .arg(arg("absolute-path").long("absolute-path").short("a"))73 .arg(arg("follow").long("follow").short("L").alias("dereference"))74 .arg(arg("full-path").long("full-path").short("p"))75 .arg(arg("null_separator").long("print0").short("0"))76 .arg(arg("depth").long("max-depth").short("d").takes_value(true))2 unmodified lines79 arg("rg-depth")80 .long("maxdepth")81 .hidden(true)82 .takes_value(true),83+ )79- ).arg(84+ .arg(85 arg("file-type")86 .long("type")87 .short("t")88 .multiple(true)10 unmodified lines99 "x",100 "executable",101 "e",102 "empty",103+ ])98- ]).hide_possible_values(true),99- ).arg(104+ .hide_possible_values(true),105+ )106+ .arg(107 arg("extension")108 .long("extension")109 .short("e")110 .multiple(true)111 .number_of_values(1)112 .takes_value(true)113 .value_name("ext"),114+ )107- ).arg(115+ .arg(116 arg("exec")117 .long("exec")118 .short("x")119 .min_values(1)120 .allow_hyphen_values(true)121 .value_terminator(";")122 .value_name("cmd"),123+ )115- ).arg(124+ .arg(125 arg("exclude")126 .long("exclude")127 .short("E")128 .takes_value(true)129 .value_name("pattern")130 .number_of_values(1)131 .multiple(true),132+ )123- ).arg(133+ .arg(134 arg("ignore-file")135 .long("ignore-file")136 .takes_value(true)137 .value_name("path")138 .number_of_values(1)139 .multiple(true),140+ )130- ).arg(141+ .arg(142 arg("color")143 .long("color")144 .short("c")145 .takes_value(true)146 .value_name("when")147 .possible_values(&["never", "auto", "always"])148 .hide_possible_values(true),149+ )138- ).arg(150+ .arg(151 arg("threads")152 .long("threads")153 .short("j")154 .takes_value(true)155 .value_name("num"),156+ )144- ).arg(157+ .arg(158 arg("size")159 .long("size")160 .short("S")161 .takes_value(true)162 .number_of_values(1)163 .allow_hyphen_values(true)164 .multiple(true),165+ )152- ).arg(166+ .arg(167 arg("max-buffer-time")168 .long("max-buffer-time")169 .takes_value(true)170 .hidden(true),171+ )157- ).arg(arg("pattern"))172+ .arg(arg("pattern"))173 .arg(arg("path").multiple(true))174 }175 176 #[cfg_attr(rustfmt, rustfmt_skip)]120 unmodified linesmodified:src/main.rs+10 added-5 removed
65 unmodified lines66 path_buffer.to_string_lossy()67 ));68 }69 path_buffer70+ })70- }).collect::<Vec<_>>(),71+ .collect::<Vec<_>>(),72 None => vec![current_dir.to_path_buf()],73 };74 75 if matches.is_present("absolute-path") {3 unmodified lines79 path_buffer80 .canonicalize()81 .and_then(|pb| fshelper::absolute_path(pb.as_path()))82 .unwrap()83+ })82- }).collect();84+ .collect();85 }86 87 // Detect if the user accidentally supplied a path instead of a search pattern88 if !matches.is_present("full-path")53 unmodified lines142 if let Some(f) = SizeFilter::from_string(sf) {143 return f;144 }145 error(&format!("Error: {} is not a valid size constraint.", sf));144- }).collect()145- }).unwrap_or_else(|| vec![]);146+ })147+ .collect()148+ })149+ .unwrap_or_else(|| vec![]);150 151 let config = FdOptions {152 case_sensitive,153 search_full_path: matches.is_present("full-path"),82 unmodified lines236 format!(237 "{}\nHint: You can use the '--fixed-strings' option to search for a \238 literal string instead of a regular expression",239 err.description()240+ )236- ).as_str(),241+ .as_str(),242 ),243 }244 }modified:src/walk.rs+2 added-1 removed
104 unmodified lines105 if config.ls_colors.is_some() && config.command.is_none() {106 let wq = Arc::clone(&receiver_wtq);107 ctrlc::set_handler(move || {108 wq.store(true, Ordering::Relaxed);109+ })109- }).unwrap();110+ .unwrap();111 }112 113 // Spawn the thread that receives all results through the channel.114 let rx_config = Arc::clone(&config);191 unmodified linesmodified:tests/testenv/mod.rs+4 added-2 removed
104 unmodified lines105 .map(|diff| match diff {106 diff::Result::Left(l) => format!("-{}", l),107 diff::Result::Both(l, _) => format!(" {}", l),108 diff::Result::Right(r) => format!("+{}", r),109+ })109- }).collect::<Vec<_>>()110+ .collect::<Vec<_>>()111 .join("\n");112 113 format!(114 concat!(13 unmodified lines128 .lines()129 .map(|line| {130 let line = if trim_left { line.trim_left() } else { line };131 line.replace('/', &std::path::MAIN_SEPARATOR.to_string())132+ })131- }).collect::<Vec<_>>();133+ .collect::<Vec<_>>();134 135 lines.sort_by_key(|s| s.clone());136 137 lines.join("\n")60 unmodified linesmodified:tests/tests.rs+2 added-1 removed
1026 unmodified lines1027 1028 fs::File::create(1029 te.test_root()1030 .join(OsStr::from_bytes(b"test1/test_\xFEinvalid.txt")),1031+ )1031- ).unwrap();1032+ .unwrap();1033 1034 te.assert_output(&["", "test1/"], "test1/test_�invalid.txt");1035 1036 te.assert_output(&["invalid", "test1/"], "test1/test_�invalid.txt");76 unmodified lines