Skip to content

Commit a3a7021

Browse files
authored
fix(cli): pass --no-default-features to runner instead of app, closes #5415 (#5474)
1 parent cb6ee77 commit a3a7021

2 files changed

Lines changed: 20 additions & 14 deletions

File tree

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"cli.rs": "patch"
3+
---
4+
5+
Fix cli passing `--no-default-features` to the app instead of the runner (Cargo).

tooling/cli/src/interface/rust.rs

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,20 @@ impl Rust {
285285
mut options: Options,
286286
on_exit: F,
287287
) -> crate::Result<DevChild> {
288-
if !options.args.contains(&"--no-default-features".into()) {
288+
let mut args = Vec::new();
289+
let mut run_args = Vec::new();
290+
let mut reached_run_args = false;
291+
for arg in options.args.clone() {
292+
if reached_run_args {
293+
run_args.push(arg);
294+
} else if arg == "--" {
295+
reached_run_args = true;
296+
} else {
297+
args.push(arg);
298+
}
299+
}
300+
301+
if !args.contains(&"--no-default-features".into()) {
289302
let manifest_features = self.app_settings.manifest.features();
290303
let enable_features: Vec<String> = manifest_features
291304
.get("default")
@@ -300,7 +313,7 @@ impl Rust {
300313
}
301314
})
302315
.collect();
303-
options.args.push("--no-default-features".into());
316+
args.push("--no-default-features".into());
304317
if !enable_features.is_empty() {
305318
options
306319
.features
@@ -309,18 +322,6 @@ impl Rust {
309322
}
310323
}
311324

312-
let mut args = Vec::new();
313-
let mut run_args = Vec::new();
314-
let mut reached_run_args = false;
315-
for arg in options.args.clone() {
316-
if reached_run_args {
317-
run_args.push(arg);
318-
} else if arg == "--" {
319-
reached_run_args = true;
320-
} else {
321-
args.push(arg);
322-
}
323-
}
324325
options.args = args;
325326

326327
desktop::run_dev(

0 commit comments

Comments
 (0)