File tree 2 files changed +36
-0
lines changed
2 files changed +36
-0
lines changed Original file line number Diff line number Diff line change
1
+ #![ deny( unused_must_use) ]
2
+
3
+ #[ must_use]
4
+ trait Critical { }
5
+
6
+ trait NotSoCritical { }
7
+
8
+ trait DecidedlyUnimportant { }
9
+
10
+ struct Anon ;
11
+
12
+ impl Critical for Anon { }
13
+ impl NotSoCritical for Anon { }
14
+ impl DecidedlyUnimportant for Anon { }
15
+
16
+ fn get_critical ( ) -> impl NotSoCritical + Critical + DecidedlyUnimportant {
17
+ Anon { }
18
+ }
19
+
20
+ fn main ( ) {
21
+ get_critical ( ) ; //~ ERROR unused implementer of `Critical` that must be used
22
+ }
Original file line number Diff line number Diff line change
1
+ error: unused implementer of `Critical` that must be used
2
+ --> $DIR/must_use-trait.rs:21:5
3
+ |
4
+ LL | get_critical(); //~ ERROR unused implementer of `Critical` that must be used
5
+ | ^^^^^^^^^^^^^^^
6
+ |
7
+ note: lint level defined here
8
+ --> $DIR/must_use-trait.rs:1:9
9
+ |
10
+ LL | #![deny(unused_must_use)]
11
+ | ^^^^^^^^^^^^^^^
12
+
13
+ error: aborting due to previous error
14
+
You can’t perform that action at this time.
0 commit comments