Skip to content

Commit 12aa62c

Browse files
committed
test(lints): show lint error number
This wasn't shown because AlreadyPrintedError was skipped.
1 parent 47a6c04 commit 12aa62c

File tree

1 file changed

+42
-0
lines changed

1 file changed

+42
-0
lines changed

tests/testsuite/lints/blanket_hint_mostly_unused.rs

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,3 +165,45 @@ authors = []
165165
"#]])
166166
.run();
167167
}
168+
169+
#[cargo_test(nightly, reason = "-Zhint-mostly-unused is unstable")]
170+
fn deny() {
171+
let p = project()
172+
.file(
173+
"Cargo.toml",
174+
r#"
175+
[package]
176+
name = "foo"
177+
version = "0.0.1"
178+
edition = "2015"
179+
180+
[profile.dev]
181+
hint-mostly-unused = true
182+
183+
[lints.cargo]
184+
blanket_hint_mostly_unused = "deny"
185+
"#,
186+
)
187+
.file("src/main.rs", "fn main() {}")
188+
.build();
189+
p.cargo("check -Zprofile-hint-mostly-unused -v -Zcargo-lints")
190+
.masquerade_as_nightly_cargo(&["profile-hint-mostly-unused", "cargo-lints"])
191+
.with_status(101)
192+
.with_stderr_data(str![[r#"
193+
[ERROR] `hint-mostly-unused` is being blanket applied to all dependencies
194+
--> Cargo.toml:7:10
195+
|
196+
7 | [profile.dev]
197+
| ^^^
198+
8 | hint-mostly-unused = true
199+
| -------------------------
200+
|
201+
= [NOTE] `cargo::blanket_hint_mostly_unused` is set to `deny` in `[lints]`
202+
[HELP] scope `hint-mostly-unused` to specific packages with a lot of unused object code
203+
|
204+
7 | [profile.dev.package.<pkg_name>]
205+
| +++++++++++++++++++
206+
207+
"#]])
208+
.run();
209+
}

0 commit comments

Comments
 (0)