Skip to content

Commit 327f534

Browse files
Don't pass build flags when not building
The default build flags is --all-targets. Passing this to `cargo run` doesn't work.
1 parent fab10a2 commit 327f534

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

src/proxy.rs

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -122,16 +122,18 @@ impl<'a> CargoRunner<'a> {
122122
self.args,
123123
&self.config.raw.common,
124124
);
125-
let default_build_flags = ["--all-targets".to_owned()];
126-
for flag in self
127-
.config
128-
.raw
129-
.common
130-
.build_flags
131-
.as_deref()
132-
.unwrap_or(default_build_flags.as_slice())
133-
{
134-
command.arg(flag);
125+
if self.args.command.is_none() {
126+
let default_build_flags = ["--all-targets".to_owned()];
127+
for flag in self
128+
.config
129+
.raw
130+
.common
131+
.build_flags
132+
.as_deref()
133+
.unwrap_or(default_build_flags.as_slice())
134+
{
135+
command.arg(flag);
136+
}
135137
}
136138
let rustc_path = rustup_rustc_path().unwrap_or_else(|_| PathBuf::from("rustc"));
137139
if let Some(target) = &self.args.target {

0 commit comments

Comments
 (0)