Skip to content
Myr

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

6 files+50 added−25 removed

modified:src/fshelper/mod.rs+2 added-1 removed
31 unmodified lines
32 path_buf33 .as_path()34 .to_string_lossy()35 .trim_left_matches(r"\\?\"),36 )36 ).to_path_buf();37 .to_path_buf();3839 Ok(path_buf)40}41
37 unmodified lines
modified:src/app.rs+30 added-15 removed
48 unmodified lines
49 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 lines
79 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 lines
99 "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}175176#[cfg_attr(rustfmt, rustfmt_skip)]
120 unmodified lines
modified:src/main.rs+10 added-5 removed
65 unmodified lines
66 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 };7475 if matches.is_present("absolute-path") {
3 unmodified lines
79 path_buffer80 .canonicalize()81 .and_then(|pb| fshelper::absolute_path(pb.as_path()))82 .unwrap()83 })82 }).collect();84 .collect();85 }8687 // Detect if the user accidentally supplied a path instead of a search pattern88 if !matches.is_present("full-path")
53 unmodified lines
142 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![]);150151 let config = FdOptions {152 case_sensitive,153 search_full_path: matches.is_present("full-path"),
82 unmodified lines
236 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 lines
105 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 }112113 // Spawn the thread that receives all results through the channel.114 let rx_config = Arc::clone(&config);
191 unmodified lines
modified:tests/testenv/mod.rs+4 added-2 removed
104 unmodified lines
105 .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");112113 format!(114 concat!(
13 unmodified lines
128 .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<_>>();134135 lines.sort_by_key(|s| s.clone());136137 lines.join("\n")
60 unmodified lines
modified:tests/tests.rs+2 added-1 removed
1026 unmodified lines
10271028 fs::File::create(1029 te.test_root()1030 .join(OsStr::from_bytes(b"test1/test_\xFEinvalid.txt")),1031 )1031 ).unwrap();1032 .unwrap();10331034 te.assert_output(&["", "test1/"], "test1/test_�invalid.txt");10351036 te.assert_output(&["invalid", "test1/"], "test1/test_�invalid.txt");
76 unmodified lines