Passing program arguments through Cargo

You can pass trailing arguments to cargo run using --:

cargo run -- --test

From the man page:

All of the trailing arguments are passed to the binary to run. If you’re passing
arguments to both Cargo and the binary, the ones after -- go to the binary,
the ones before go to Cargo.

Leave a Comment

tech