Skip to content

Commit 4760ef7

Browse files
committed
test(lints): Verify we can't un-inherit
1 parent ef6954c commit 4760ef7

File tree

1 file changed

+45
-0
lines changed

1 file changed

+45
-0
lines changed

tests/testsuite/lints.rs

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -306,6 +306,51 @@ error: usage of an `unsafe` block
306306
.run();
307307
}
308308

309+
#[cargo_test]
310+
fn workspace_cant_be_false() {
311+
let foo = project()
312+
.file(
313+
"Cargo.toml",
314+
r#"
315+
[package]
316+
name = "foo"
317+
version = "0.0.1"
318+
authors = []
319+
320+
[lints]
321+
workspace = false
322+
323+
[workspace.lints.rust]
324+
"unsafe_code" = "deny"
325+
"#,
326+
)
327+
.file(
328+
"src/lib.rs",
329+
"
330+
pub fn foo(num: i32) -> u32 {
331+
unsafe { std::mem::transmute(num) }
332+
}
333+
",
334+
)
335+
.build();
336+
337+
foo.cargo("check")
338+
.with_status(101)
339+
.with_stderr_contains(
340+
"\
341+
error: failed to parse manifest at `[CWD]/Cargo.toml`
342+
343+
Caused by:
344+
TOML parse error at line 8, column 29
345+
|
346+
8 | workspace = false
347+
| ^^^^^
348+
`workspace` cannot be false
349+
",
350+
)
351+
.run();
352+
}
353+
309354
#[cargo_test]
310355
fn workspace_lint_deny() {
311356
let foo = project()

0 commit comments

Comments
 (0)