mirror of
https://github.com/rust-lang/cargo
synced 2024-09-13 21:11:44 +00:00
test(lints): Verify we can't un-inherit
This commit is contained in:
parent
ef6954cd01
commit
4760ef7822
|
@ -306,6 +306,51 @@ error: usage of an `unsafe` block
|
||||||
.run();
|
.run();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cargo_test]
|
||||||
|
fn workspace_cant_be_false() {
|
||||||
|
let foo = project()
|
||||||
|
.file(
|
||||||
|
"Cargo.toml",
|
||||||
|
r#"
|
||||||
|
[package]
|
||||||
|
name = "foo"
|
||||||
|
version = "0.0.1"
|
||||||
|
authors = []
|
||||||
|
|
||||||
|
[lints]
|
||||||
|
workspace = false
|
||||||
|
|
||||||
|
[workspace.lints.rust]
|
||||||
|
"unsafe_code" = "deny"
|
||||||
|
"#,
|
||||||
|
)
|
||||||
|
.file(
|
||||||
|
"src/lib.rs",
|
||||||
|
"
|
||||||
|
pub fn foo(num: i32) -> u32 {
|
||||||
|
unsafe { std::mem::transmute(num) }
|
||||||
|
}
|
||||||
|
",
|
||||||
|
)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
foo.cargo("check")
|
||||||
|
.with_status(101)
|
||||||
|
.with_stderr_contains(
|
||||||
|
"\
|
||||||
|
error: failed to parse manifest at `[CWD]/Cargo.toml`
|
||||||
|
|
||||||
|
Caused by:
|
||||||
|
TOML parse error at line 8, column 29
|
||||||
|
|
|
||||||
|
8 | workspace = false
|
||||||
|
| ^^^^^
|
||||||
|
`workspace` cannot be false
|
||||||
|
",
|
||||||
|
)
|
||||||
|
.run();
|
||||||
|
}
|
||||||
|
|
||||||
#[cargo_test]
|
#[cargo_test]
|
||||||
fn workspace_lint_deny() {
|
fn workspace_lint_deny() {
|
||||||
let foo = project()
|
let foo = project()
|
||||||
|
|
Loading…
Reference in a new issue