What it does
Emit a warning when an argument of the form "-x foo", "--abc bar", /X baz, or a concatenation of these is passed to std::process::Command::arg(...) and suggest to use either multiple arg calls or a single args call instead.
In these cases the programmer likely intended to pass multiple args to the process, and probably wants to use something like std::process::Command::args(["-x", "foo"]) instead.
Lint Name
possible_multiple_args_in_arg
Category
suspicious
Advantage
- prevent unintended behavior when executing other processes with
Command.
Drawbacks
This lint will by design always have some false-positives as Clippy can't be sure this isn't what you wanted to do.
Example
std::process::Command::new("mkdir")
.arg("-p foo/bar")
Could be written as:
std::process::Command::new("mdkir")
.args(["-p", "foo/bar"])