Run cargo fmt

This commit is contained in:
sharkdp 2018-08-03 20:14:27 +02:00 committed by David Peter
parent 59c9901cde
commit c428f52209
3 changed files with 20 additions and 40 deletions

View file

@ -50,26 +50,22 @@ pub fn build_app() -> App<'static, 'static> {
.short("u") .short("u")
.multiple(true) .multiple(true)
.hidden(true), .hidden(true),
) ).arg(
.arg(
arg("case-sensitive") arg("case-sensitive")
.long("case-sensitive") .long("case-sensitive")
.short("s") .short("s")
.overrides_with("ignore-case"), .overrides_with("ignore-case"),
) ).arg(
.arg(
arg("ignore-case") arg("ignore-case")
.long("ignore-case") .long("ignore-case")
.short("i") .short("i")
.overrides_with("case-sensitive"), .overrides_with("case-sensitive"),
) ).arg(
.arg(
arg("fixed-strings") arg("fixed-strings")
.long("fixed-strings") .long("fixed-strings")
.short("F") .short("F")
.alias("literal"), .alias("literal"),
) ).arg(arg("absolute-path").long("absolute-path").short("a"))
.arg(arg("absolute-path").long("absolute-path").short("a"))
.arg(arg("follow").long("follow").short("L").alias("dereference")) .arg(arg("follow").long("follow").short("L").alias("dereference"))
.arg(arg("full-path").long("full-path").short("p")) .arg(arg("full-path").long("full-path").short("p"))
.arg(arg("null_separator").long("print0").short("0")) .arg(arg("null_separator").long("print0").short("0"))
@ -91,10 +87,8 @@ pub fn build_app() -> App<'static, 'static> {
"symlink", "symlink",
"x", "x",
"executable", "executable",
]) ]).hide_possible_values(true),
.hide_possible_values(true), ).arg(
)
.arg(
arg("extension") arg("extension")
.long("extension") .long("extension")
.short("e") .short("e")
@ -102,8 +96,7 @@ pub fn build_app() -> App<'static, 'static> {
.number_of_values(1) .number_of_values(1)
.takes_value(true) .takes_value(true)
.value_name("ext"), .value_name("ext"),
) ).arg(
.arg(
arg("exec") arg("exec")
.long("exec") .long("exec")
.short("x") .short("x")
@ -111,8 +104,7 @@ pub fn build_app() -> App<'static, 'static> {
.allow_hyphen_values(true) .allow_hyphen_values(true)
.value_terminator(";") .value_terminator(";")
.value_name("cmd"), .value_name("cmd"),
) ).arg(
.arg(
arg("exclude") arg("exclude")
.long("exclude") .long("exclude")
.short("E") .short("E")
@ -120,16 +112,14 @@ pub fn build_app() -> App<'static, 'static> {
.value_name("pattern") .value_name("pattern")
.number_of_values(1) .number_of_values(1)
.multiple(true), .multiple(true),
) ).arg(
.arg(
arg("ignore-file") arg("ignore-file")
.long("ignore-file") .long("ignore-file")
.takes_value(true) .takes_value(true)
.value_name("path") .value_name("path")
.number_of_values(1) .number_of_values(1)
.multiple(true), .multiple(true),
) ).arg(
.arg(
arg("color") arg("color")
.long("color") .long("color")
.short("c") .short("c")
@ -137,15 +127,13 @@ pub fn build_app() -> App<'static, 'static> {
.value_name("when") .value_name("when")
.possible_values(&["never", "auto", "always"]) .possible_values(&["never", "auto", "always"])
.hide_possible_values(true), .hide_possible_values(true),
) ).arg(
.arg(
arg("threads") arg("threads")
.long("threads") .long("threads")
.short("j") .short("j")
.takes_value(true) .takes_value(true)
.value_name("num"), .value_name("num"),
) ).arg(
.arg(
arg("size") arg("size")
.long("size") .long("size")
.short("S") .short("S")
@ -153,14 +141,12 @@ pub fn build_app() -> App<'static, 'static> {
.number_of_values(1) .number_of_values(1)
.allow_hyphen_values(true) .allow_hyphen_values(true)
.multiple(true), .multiple(true),
) ).arg(
.arg(
arg("max-buffer-time") arg("max-buffer-time")
.long("max-buffer-time") .long("max-buffer-time")
.takes_value(true) .takes_value(true)
.hidden(true), .hidden(true),
) ).arg(arg("pattern"))
.arg(arg("pattern"))
.arg(arg("path").multiple(true)) .arg(arg("path").multiple(true))
} }

View file

@ -67,8 +67,7 @@ fn main() {
)); ));
} }
path_buffer path_buffer
}) }).collect::<Vec<_>>(),
.collect::<Vec<_>>(),
None => vec![current_dir.to_path_buf()], None => vec![current_dir.to_path_buf()],
}; };
@ -80,8 +79,7 @@ fn main() {
.canonicalize() .canonicalize()
.and_then(|pb| fshelper::absolute_path(pb.as_path())) .and_then(|pb| fshelper::absolute_path(pb.as_path()))
.unwrap() .unwrap()
}) }).collect();
.collect();
} }
// Detect if the user accidentally supplied a path instead of a search pattern // Detect if the user accidentally supplied a path instead of a search pattern
@ -144,8 +142,7 @@ fn main() {
} }
error(&format!("Error: {} is not a valid size constraint.", sf)); error(&format!("Error: {} is not a valid size constraint.", sf));
}).collect() }).collect()
}) }).unwrap_or_else(|| vec![]);
.unwrap_or_else(|| vec![]);
let config = FdOptions { let config = FdOptions {
case_sensitive, case_sensitive,

View file

@ -106,8 +106,7 @@ fn format_output_error(args: &[&str], expected: &str, actual: &str) -> String {
diff::Result::Left(l) => format!("-{}", l), diff::Result::Left(l) => format!("-{}", l),
diff::Result::Both(l, _) => format!(" {}", l), diff::Result::Both(l, _) => format!(" {}", l),
diff::Result::Right(r) => format!("+{}", r), diff::Result::Right(r) => format!("+{}", r),
}) }).collect::<Vec<_>>()
.collect::<Vec<_>>()
.join("\n"); .join("\n");
format!( format!(
@ -127,11 +126,9 @@ fn normalize_output(s: &str, trim_left: bool) -> String {
.replace('\0', "NULL\n") .replace('\0', "NULL\n")
.lines() .lines()
.map(|line| { .map(|line| {
let line = let line = if trim_left { line.trim_left() } else { line };
if trim_left { line.trim_left() } else { line };
line.replace('/', &std::path::MAIN_SEPARATOR.to_string()) line.replace('/', &std::path::MAIN_SEPARATOR.to_string())
}) }).collect::<Vec<_>>();
.collect::<Vec<_>>();
lines.sort_by_key(|s| s.clone()); lines.sort_by_key(|s| s.clone());