Skip to content

Commit 9a29081

Browse files
committed
call Cargo::configure_linker only for specific commands
Calling `Cargo::configure_linker` unconditionally slows down certain commands (e.g., "check" command) without providing any benefit. Signed-off-by: onur-ozkan <[email protected]>
1 parent 60d1465 commit 9a29081

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/bootstrap/src/core/builder.rs

+9-1
Original file line numberDiff line numberDiff line change
@@ -2446,7 +2446,15 @@ impl Cargo {
24462446
cmd_kind: Kind,
24472447
) -> Cargo {
24482448
let mut cargo = builder.cargo(compiler, mode, source_type, target, cmd_kind);
2449-
cargo.configure_linker(builder);
2449+
2450+
match cmd_kind {
2451+
// No need to configure the target linker for these command types.
2452+
Kind::Clean | Kind::Check | Kind::Suggest | Kind::Format | Kind::Setup => {}
2453+
_ => {
2454+
cargo.configure_linker(builder);
2455+
}
2456+
}
2457+
24502458
cargo
24512459
}
24522460

0 commit comments

Comments
 (0)