Skip to content

Commit ef6954c

Browse files
committed
test(lints): Check unused key status
1 parent bde42f1 commit ef6954c

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

tests/testsuite/lints.rs

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,36 @@ Caused by:
148148
.run();
149149
}
150150

151+
#[cargo_test]
152+
fn warn_on_unused_key() {
153+
let foo = project()
154+
.file(
155+
"Cargo.toml",
156+
r#"
157+
[package]
158+
name = "foo"
159+
version = "0.0.1"
160+
161+
[workspace.lints.rust]
162+
rust-2018-idioms = { level = "allow", unused = true }
163+
[lints.rust]
164+
rust-2018-idioms = { level = "allow", unused = true }
165+
"#,
166+
)
167+
.file("src/lib.rs", "")
168+
.build();
169+
170+
foo.cargo("check")
171+
.with_stderr(
172+
"\
173+
[WARNING] [CWD]/Cargo.toml: unused manifest key: workspace.lints.rust.rust-2018-idioms.unused
174+
[CHECKING] foo v0.0.1 ([CWD])
175+
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]s
176+
",
177+
)
178+
.run();
179+
}
180+
151181
#[cargo_test]
152182
fn fail_on_tool_injection() {
153183
let foo = project()

0 commit comments

Comments
 (0)