RS.CLIPPY.SUSPICIOUS_COMMAND_ARG_SPACE

Single command line argument that looks like it should be multiple arguments

This checker is a Clippy lint created by The Rust Project Contributors. The documentation shown here is a copy of the original documentation for: suspicious_command_arg_space. Copyright ©2025 The Rust Team. All rights reserved.

What it does

Checks for Command::arg() invocations that look like they should be multiple arguments instead, such as arg("-t ext2").

Why is this bad?

Command::arg() does not split arguments by space. An argument like arg("-t ext2") will be passed as a single argument to the command, which is likely not what was intended.

Example

std::process::Command::new("echo").arg("-n hello").spawn().unwrap();

Use instead:

std::process::Command::new("echo").args(["-n", "hello"]).spawn().unwrap();