File tree Expand file tree Collapse file tree 1 file changed +41
-0
lines changed Expand file tree Collapse file tree 1 file changed +41
-0
lines changed Original file line number Diff line number Diff line change @@ -413,6 +413,47 @@ error: usage of an `unsafe` block
413
413
. run ( ) ;
414
414
}
415
415
416
+ #[ cargo_test]
417
+ fn workspace_and_package_lints ( ) {
418
+ let foo = project ( )
419
+ . file (
420
+ "Cargo.toml" ,
421
+ r#"
422
+ [package]
423
+ name = "foo"
424
+ version = "0.0.1"
425
+ authors = []
426
+
427
+ [lints]
428
+ workspace = true
429
+ [lints.rust]
430
+ "unsafe_code" = "allow"
431
+
432
+ [workspace.lints.rust]
433
+ "unsafe_code" = "deny"
434
+ "# ,
435
+ )
436
+ . file (
437
+ "src/lib.rs" ,
438
+ "
439
+ pub fn foo(num: i32) -> u32 {
440
+ unsafe { std::mem::transmute(num) }
441
+ }
442
+ " ,
443
+ )
444
+ . build ( ) ;
445
+
446
+ foo. cargo ( "check -Zlints" )
447
+ . masquerade_as_nightly_cargo ( & [ "lints" ] )
448
+ . with_status ( 101 )
449
+ . with_stderr_contains (
450
+ "\
451
+ error: usage of an `unsafe` block
452
+ " ,
453
+ )
454
+ . run ( ) ;
455
+ }
456
+
416
457
#[ cargo_test]
417
458
fn attribute_has_precedence ( ) {
418
459
let foo = project ( )
You can’t perform that action at this time.
0 commit comments