Skip to content

Commit c3b104e

Browse files
committed
test(cargo-lints): Show workspace lints always inherited
1 parent cb1123f commit c3b104e

File tree

1 file changed

+47
-0
lines changed

1 file changed

+47
-0
lines changed

tests/testsuite/lints_table.rs

+47
Original file line numberDiff line numberDiff line change
@@ -982,3 +982,50 @@ error: `im_a_teapot` is specified
982982
)
983983
.run();
984984
}
985+
986+
#[cargo_test]
987+
fn dont_always_inherit_workspace_lints() {
988+
let p = project()
989+
.file(
990+
"Cargo.toml",
991+
r#"
992+
[workspace]
993+
members = ["foo"]
994+
995+
[workspace.lints.cargo]
996+
im-a-teapot = "warn"
997+
"#,
998+
)
999+
.file(
1000+
"foo/Cargo.toml",
1001+
r#"
1002+
cargo-features = ["test-dummy-unstable"]
1003+
1004+
[package]
1005+
name = "foo"
1006+
version = "0.0.1"
1007+
edition = "2015"
1008+
authors = []
1009+
im-a-teapot = true
1010+
"#,
1011+
)
1012+
.file("foo/src/lib.rs", "")
1013+
.build();
1014+
1015+
p.cargo("check -Zcargo-lints")
1016+
.masquerade_as_nightly_cargo(&["cargo-lints"])
1017+
.with_stderr(
1018+
"\
1019+
warning: `im_a_teapot` is specified
1020+
--> foo/Cargo.toml:9:1
1021+
|
1022+
9 | im-a-teapot = true
1023+
| ------------------
1024+
|
1025+
= note: `cargo::im_a_teapot` is set to `warn` in `[workspace.lints]`
1026+
[CHECKING] foo v0.0.1 ([CWD]/foo)
1027+
[FINISHED] [..]
1028+
",
1029+
)
1030+
.run();
1031+
}

0 commit comments

Comments
 (0)