mirror of https://github.com/sharkdp/fd.git
Fix code style warnings.
This commit is contained in:
parent
ddf8f03d8e
commit
4b6fca7536
|
@ -75,11 +75,11 @@ impl CommandSetDisplay<'_> {
|
|||
Some(cmd_hl_str) => res.push_str(&cmd_hl_str),
|
||||
}
|
||||
}
|
||||
res.push_str("\n");
|
||||
res.push('\n');
|
||||
Some(res)
|
||||
}
|
||||
|
||||
fn write_entry_string(
|
||||
fn print_entry_string(
|
||||
entry: &DirEntry,
|
||||
argt: &ArgumentTemplate,
|
||||
config: &Config,
|
||||
|
@ -96,7 +96,7 @@ impl CommandSetDisplay<'_> {
|
|||
stdout.flush()
|
||||
}
|
||||
|
||||
fn print_pre_args(args: &Vec<OsString>) -> std::io::Result<()> {
|
||||
fn print_pre_args(args: &[OsString]) -> std::io::Result<()> {
|
||||
let stdout = io::stdout();
|
||||
let mut stdout = stdout.lock();
|
||||
|
||||
|
@ -109,7 +109,7 @@ impl CommandSetDisplay<'_> {
|
|||
stdout.flush()
|
||||
}
|
||||
|
||||
fn print_post_args(args: &Vec<OsString>) -> std::io::Result<()> {
|
||||
fn print_post_args(args: &[OsString]) -> std::io::Result<()> {
|
||||
let stdout = io::stdout();
|
||||
let mut stdout = stdout.lock();
|
||||
|
||||
|
@ -119,7 +119,7 @@ impl CommandSetDisplay<'_> {
|
|||
write!(stdout, "{} ", arg_str)?;
|
||||
}
|
||||
}
|
||||
write!(stdout, "\n")?;
|
||||
writeln!(stdout)?;
|
||||
stdout.flush()
|
||||
}
|
||||
}
|
||||
|
@ -223,7 +223,7 @@ impl CommandSet {
|
|||
|
||||
// If provided print config, print command arguments.
|
||||
if let Some(config) = print_with_config {
|
||||
if let Err(e) = CommandSetDisplay::write_entry_string(
|
||||
if let Err(e) = CommandSetDisplay::print_entry_string(
|
||||
&entry,
|
||||
&builder.path_arg,
|
||||
config,
|
||||
|
@ -453,7 +453,7 @@ impl CommandTemplate {
|
|||
res.push(" ");
|
||||
res.push(arg.generate_with_highlight(entry, path_separator, config));
|
||||
}
|
||||
return res.to_str().and_then(|s| Some(String::from(s)));
|
||||
return res.to_str().map(|s| String::from(s));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1709,6 +1709,32 @@ fn test_print_exec() {
|
|||
directory_foo",
|
||||
);
|
||||
|
||||
te.assert_output(
|
||||
&[
|
||||
"--path-separator=#",
|
||||
"--print-exec",
|
||||
"--absolute-path",
|
||||
"foo",
|
||||
"--exec",
|
||||
"echo",
|
||||
],
|
||||
&format!(
|
||||
"echo {abs_path}#a.foo
|
||||
echo {abs_path}#one#b.foo
|
||||
echo {abs_path}#one#two#C.Foo2
|
||||
echo {abs_path}#one#two#c.foo
|
||||
echo {abs_path}#one#two#three#d.foo
|
||||
echo {abs_path}#one#two#three#directory_foo
|
||||
{abs_path}#a.foo
|
||||
{abs_path}#one#b.foo
|
||||
{abs_path}#one#two#C.Foo2
|
||||
{abs_path}#one#two#c.foo
|
||||
{abs_path}#one#two#three#d.foo
|
||||
{abs_path}#one#two#three#directory_foo",
|
||||
abs_path = abs_path.replace(std::path::MAIN_SEPARATOR, "#"),
|
||||
),
|
||||
);
|
||||
|
||||
te.assert_output(
|
||||
&["foo", "--print-exec", "--exec-batch", "echo", "beginarg", "{}", "endarg"],
|
||||
"echo beginarg ./a.foo ./one/b.foo ./one/two/C.Foo2 ./one/two/c.foo ./one/two/three/d.foo ./one/two/three/directory_foo endarg
|
||||
|
|
Loading…
Reference in New Issue