File tree Expand file tree Collapse file tree 2 files changed +40
-0
lines changed Expand file tree Collapse file tree 2 files changed +40
-0
lines changed Original file line number Diff line number Diff line change
1
+ //@ check-pass
2
+ #![ warn( dead_code) ]
3
+
4
+ enum E {
5
+ F ( ) ,
6
+ C ( ) ,
7
+ }
8
+
9
+ impl E {
10
+ #[ expect( non_snake_case) ]
11
+ fn F ( ) { }
12
+ //~^ WARN: associated items `F` and `C` are never used
13
+
14
+ const C : ( ) = ( ) ;
15
+ }
16
+
17
+ fn main ( ) {
18
+ let _: E = E :: F ( ) ;
19
+ let _: E = E :: C ( ) ;
20
+ }
Original file line number Diff line number Diff line change
1
+ warning: associated items `F` and `C` are never used
2
+ --> $DIR/dead-code-associated-function.rs:11:8
3
+ |
4
+ LL | impl E {
5
+ | ------ associated items in this implementation
6
+ LL | #[expect(non_snake_case)]
7
+ LL | fn F() {}
8
+ | ^
9
+ ...
10
+ LL | const C: () = ();
11
+ | ^
12
+ |
13
+ note: the lint level is defined here
14
+ --> $DIR/dead-code-associated-function.rs:2:9
15
+ |
16
+ LL | #![warn(dead_code)]
17
+ | ^^^^^^^^^
18
+
19
+ warning: 1 warning emitted
20
+
You can’t perform that action at this time.
0 commit comments