Skip to content

Commit 02f96ea

Browse files
committed
fix: Put lints after profile.rustflags
1 parent 9b1843f commit 02f96ea

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

src/cargo/core/compiler/mod.rs

+3-4
Original file line numberDiff line numberDiff line change
@@ -1041,10 +1041,6 @@ fn build_base_args(
10411041
cmd.arg("-C").arg(&format!("opt-level={}", opt_level));
10421042
}
10431043

1044-
if !rustflags.is_empty() {
1045-
cmd.args(&rustflags);
1046-
}
1047-
10481044
if *panic != PanicStrategy::Unwind {
10491045
cmd.arg("-C").arg(format!("panic={}", panic));
10501046
}
@@ -1080,6 +1076,9 @@ fn build_base_args(
10801076
}
10811077

10821078
cmd.args(unit.pkg.manifest().rustflags());
1079+
if !rustflags.is_empty() {
1080+
cmd.args(&rustflags);
1081+
}
10831082
if let Some(args) = cx.bcx.extra_args_for(unit) {
10841083
cmd.args(args);
10851084
}

tests/testsuite/lints.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -440,7 +440,7 @@ pub fn foo(num: i32) -> u32 {
440440
}
441441

442442
#[cargo_test]
443-
fn profile_rustflags_doesnt_have_precedence() {
443+
fn profile_rustflags_has_precedence() {
444444
let foo = project()
445445
.file(
446446
"Cargo.toml",
@@ -452,10 +452,10 @@ fn profile_rustflags_doesnt_have_precedence() {
452452
version = "0.0.1"
453453
454454
[lints.rust]
455-
"unsafe_code" = "allow"
455+
"unsafe_code" = "deny"
456456
457457
[profile.dev]
458-
rustflags = ["-D", "unsafe_code"]
458+
rustflags = ["-A", "unsafe_code"]
459459
"#,
460460
)
461461
.file(

0 commit comments

Comments
 (0)