Skip to content

Commit 5fefe8b

Browse files
committed
Add test.
1 parent 145e6a9 commit 5fefe8b

File tree

2 files changed

+30
-0
lines changed

2 files changed

+30
-0
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
fn main() {
2+
std::process::Command::new("echo").arg("hello world").spawn().unwrap();
3+
std::process::Command::new("echo").arg("-n hello").spawn().unwrap();
4+
std::process::Command::new("cat").arg("--number file").spawn().unwrap();
5+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
error: single argument that looks like it should be multiple arguments
2+
--> $DIR/suspicious_command_arg_space.rs:3:44
3+
|
4+
LL | std::process::Command::new("echo").arg("-n hello").spawn().unwrap();
5+
| ^^^^^^^^^^
6+
|
7+
= note: `-D clippy::suspicious-command-arg-space` implied by `-D warnings`
8+
help: consider splitting the argument
9+
|
10+
LL | std::process::Command::new("echo").args(["-n", "hello"]).spawn().unwrap();
11+
| ~~~~ ~~~~~~~~~~~~~~~
12+
13+
error: single argument that looks like it should be multiple arguments
14+
--> $DIR/suspicious_command_arg_space.rs:4:43
15+
|
16+
LL | std::process::Command::new("cat").arg("--number file").spawn().unwrap();
17+
| ^^^^^^^^^^^^^^^
18+
|
19+
help: consider splitting the argument
20+
|
21+
LL | std::process::Command::new("cat").args(["--number", "file"]).spawn().unwrap();
22+
| ~~~~ ~~~~~~~~~~~~~~~~~~~~
23+
24+
error: aborting due to 2 previous errors
25+

0 commit comments

Comments
 (0)