rust/tests/ui/suspicious_command_arg_space.fixed

14 lines
723 B
Rust
Raw Normal View History

2023-07-27 06:40:22 -05:00
fn main() {
// Things it should warn about:
std::process::Command::new("echo").args(["-n", "hello"]).spawn().unwrap();
//~^ ERROR: single argument that looks like it should be multiple arguments
//~| NOTE: `-D clippy::suspicious-command-arg-space` implied by `-D warnings`
2023-07-27 06:40:22 -05:00
std::process::Command::new("cat").args(["--number", "file"]).spawn().unwrap();
//~^ ERROR: single argument that looks like it should be multiple arguments
2023-07-27 06:40:22 -05:00
// Things it should not warn about:
std::process::Command::new("echo").arg("hello world").spawn().unwrap();
std::process::Command::new("a").arg("--fmt=%a %b %c").spawn().unwrap();
std::process::Command::new("b").arg("-ldflags=-s -w").spawn().unwrap();
}