Skip to content

Commit

Permalink
test(lints): Verify we can't un-inherit
Browse files Browse the repository at this point in the history
  • Loading branch information
epage committed Jan 8, 2024
1 parent ef6954c commit 4760ef7
Showing 1 changed file with 45 additions and 0 deletions.
45 changes: 45 additions & 0 deletions tests/testsuite/lints.rs
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,51 @@ error: usage of an `unsafe` block
.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]
fn workspace_lint_deny() {
let foo = project()
Expand Down

0 comments on commit 4760ef7

Please sign in to comment.