From c428f5220999999283989a0f365e4be05cd76e99 Mon Sep 17 00:00:00 2001 From: sharkdp Date: Fri, 3 Aug 2018 20:14:27 +0200 Subject: [PATCH] Run cargo fmt --- src/app.rs | 42 ++++++++++++++---------------------------- src/main.rs | 9 +++------ tests/testenv/mod.rs | 9 +++------ 3 files changed, 20 insertions(+), 40 deletions(-) diff --git a/src/app.rs b/src/app.rs index 3ed4059..e79e2a1 100644 --- a/src/app.rs +++ b/src/app.rs @@ -50,26 +50,22 @@ pub fn build_app() -> App<'static, 'static> { .short("u") .multiple(true) .hidden(true), - ) - .arg( + ).arg( arg("case-sensitive") .long("case-sensitive") .short("s") .overrides_with("ignore-case"), - ) - .arg( + ).arg( arg("ignore-case") .long("ignore-case") .short("i") .overrides_with("case-sensitive"), - ) - .arg( + ).arg( arg("fixed-strings") .long("fixed-strings") .short("F") .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("full-path").long("full-path").short("p")) .arg(arg("null_separator").long("print0").short("0")) @@ -91,10 +87,8 @@ pub fn build_app() -> App<'static, 'static> { "symlink", "x", "executable", - ]) - .hide_possible_values(true), - ) - .arg( + ]).hide_possible_values(true), + ).arg( arg("extension") .long("extension") .short("e") @@ -102,8 +96,7 @@ pub fn build_app() -> App<'static, 'static> { .number_of_values(1) .takes_value(true) .value_name("ext"), - ) - .arg( + ).arg( arg("exec") .long("exec") .short("x") @@ -111,8 +104,7 @@ pub fn build_app() -> App<'static, 'static> { .allow_hyphen_values(true) .value_terminator(";") .value_name("cmd"), - ) - .arg( + ).arg( arg("exclude") .long("exclude") .short("E") @@ -120,16 +112,14 @@ pub fn build_app() -> App<'static, 'static> { .value_name("pattern") .number_of_values(1) .multiple(true), - ) - .arg( + ).arg( arg("ignore-file") .long("ignore-file") .takes_value(true) .value_name("path") .number_of_values(1) .multiple(true), - ) - .arg( + ).arg( arg("color") .long("color") .short("c") @@ -137,15 +127,13 @@ pub fn build_app() -> App<'static, 'static> { .value_name("when") .possible_values(&["never", "auto", "always"]) .hide_possible_values(true), - ) - .arg( + ).arg( arg("threads") .long("threads") .short("j") .takes_value(true) .value_name("num"), - ) - .arg( + ).arg( arg("size") .long("size") .short("S") @@ -153,14 +141,12 @@ pub fn build_app() -> App<'static, 'static> { .number_of_values(1) .allow_hyphen_values(true) .multiple(true), - ) - .arg( + ).arg( arg("max-buffer-time") .long("max-buffer-time") .takes_value(true) .hidden(true), - ) - .arg(arg("pattern")) + ).arg(arg("pattern")) .arg(arg("path").multiple(true)) } diff --git a/src/main.rs b/src/main.rs index 8e11b6c..9f2c4a1 100644 --- a/src/main.rs +++ b/src/main.rs @@ -67,8 +67,7 @@ fn main() { )); } path_buffer - }) - .collect::>(), + }).collect::>(), None => vec![current_dir.to_path_buf()], }; @@ -80,8 +79,7 @@ fn main() { .canonicalize() .and_then(|pb| fshelper::absolute_path(pb.as_path())) .unwrap() - }) - .collect(); + }).collect(); } // 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)); }).collect() - }) - .unwrap_or_else(|| vec![]); + }).unwrap_or_else(|| vec![]); let config = FdOptions { case_sensitive, diff --git a/tests/testenv/mod.rs b/tests/testenv/mod.rs index 0b74a01..7cea96b 100644 --- a/tests/testenv/mod.rs +++ b/tests/testenv/mod.rs @@ -106,8 +106,7 @@ fn format_output_error(args: &[&str], expected: &str, actual: &str) -> String { diff::Result::Left(l) => format!("-{}", l), diff::Result::Both(l, _) => format!(" {}", l), diff::Result::Right(r) => format!("+{}", r), - }) - .collect::>() + }).collect::>() .join("\n"); format!( @@ -127,11 +126,9 @@ fn normalize_output(s: &str, trim_left: bool) -> String { .replace('\0', "NULL\n") .lines() .map(|line| { - let line = - if trim_left { line.trim_left() } else { line }; + let line = if trim_left { line.trim_left() } else { line }; line.replace('/', &std::path::MAIN_SEPARATOR.to_string()) - }) - .collect::>(); + }).collect::>(); lines.sort_by_key(|s| s.clone());