Skip to content

Commit 9635fef

Browse files
committed
Use method chaining more consistently when building commands.
1 parent 06f02fa commit 9635fef

File tree

1 file changed

+20
-18
lines changed

1 file changed

+20
-18
lines changed

collector/src/rustc-fake.rs

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -190,20 +190,21 @@ fn main() {
190190
"SelfProfile" => {
191191
let mut cmd = Command::new(&tool);
192192
determinism_env(&mut cmd);
193-
cmd.arg("-Zself-profile-events=all");
194-
cmd.arg("-Zself-profile=Zsp").args(&args);
193+
cmd.arg("-Zself-profile-events=all")
194+
.arg("-Zself-profile=Zsp")
195+
.args(&args);
195196

196197
assert!(cmd.status().expect("failed to spawn").success());
197198
}
198199

199200
"TimePasses" => {
200-
args.insert(0, "-Ztime-passes".into());
201-
202201
let mut cmd = Command::new(&tool);
203202
determinism_env(&mut cmd);
204-
cmd.args(args).stderr(std::process::Stdio::from(
205-
std::fs::File::create("Ztp").unwrap(),
206-
));
203+
cmd.arg("-Ztime-passes")
204+
.args(args)
205+
.stderr(std::process::Stdio::from(
206+
std::fs::File::create("Ztp").unwrap(),
207+
));
207208
assert!(cmd.status().expect("failed to spawn").success());
208209
}
209210

@@ -349,34 +350,35 @@ fn main() {
349350
}
350351

351352
"LlvmIr" => {
352-
args.push("--emit=llvm-ir=./llvm-ir".into());
353-
args.push("-Cno-prepopulate-passes".into());
354-
args.push("-Cpasses=name-anon-globals".into());
355353
let mut cmd = Command::new(tool);
356-
cmd.args(args);
354+
cmd.arg("--emit=llvm-ir=./llvm-ir")
355+
.arg("-Cno-prepopulate-passes")
356+
.arg("-Cpasses=name-anon-globals")
357+
.args(args);
357358
determinism_env(&mut cmd);
358359
assert!(cmd.status().expect("failed to spawn").success());
359360
}
360361

361362
"MonoItems" => {
362363
// Lazy item collection is the default (i.e., without this
363364
// option)
364-
args.push("-Zprint-mono-items=lazy".into());
365365
let mut cmd = Command::new(tool);
366366
determinism_env(&mut cmd);
367-
cmd.args(args).stdout(std::process::Stdio::from(
368-
std::fs::File::create("mono-items").unwrap(),
369-
));
367+
cmd.arg("-Zprint-mono-items=lazy")
368+
.args(args)
369+
.stdout(std::process::Stdio::from(
370+
std::fs::File::create("mono-items").unwrap(),
371+
));
370372

371373
assert!(cmd.status().expect("failed to spawn").success());
372374
}
373375

374376
"DepGraph" => {
375-
args.push("-Zdump-dep-graph".into());
376-
args.push("-Zquery-dep-graph".into());
377377
let mut cmd = Command::new(tool);
378378
determinism_env(&mut cmd);
379-
cmd.args(&args);
379+
cmd.arg("-Zdump-dep-graph")
380+
.arg("-Zquery-dep-graph")
381+
.args(&args);
380382

381383
assert!(cmd.status().expect("failed to spawn").success());
382384
}

0 commit comments

Comments
 (0)