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")
.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))
}

View file

@ -67,8 +67,7 @@ fn main() {
));
}
path_buffer
})
.collect::<Vec<_>>(),
}).collect::<Vec<_>>(),
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,

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::Both(l, _) => format!(" {}", l),
diff::Result::Right(r) => format!("+{}", r),
})
.collect::<Vec<_>>()
}).collect::<Vec<_>>()
.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::<Vec<_>>();
}).collect::<Vec<_>>();
lines.sort_by_key(|s| s.clone());