Add test for #[must_use] in tuples
This commit is contained in:
parent
bbac81a0f1
commit
fd36b5fd52
3 changed files with 22 additions and 2 deletions
5
src/test/ui/lint/must_use-tuple.rs
Normal file
5
src/test/ui/lint/must_use-tuple.rs
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
#![deny(unused_must_use)]
|
||||
|
||||
fn main() {
|
||||
(Ok::<(), ()>(()),); //~ ERROR unused `std::result::Result` that must be used
|
||||
}
|
||||
15
src/test/ui/lint/must_use-tuple.stderr
Normal file
15
src/test/ui/lint/must_use-tuple.stderr
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
error: unused `std::result::Result` that must be used
|
||||
--> $DIR/must_use-tuple.rs:4:5
|
||||
|
|
||||
LL | (Ok::<(), ()>(()),);
|
||||
| ^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
note: lint level defined here
|
||||
--> $DIR/must_use-tuple.rs:1:9
|
||||
|
|
||||
LL | #![deny(unused_must_use)]
|
||||
| ^^^^^^^^^^^^^^^
|
||||
= note: this `Result` may be an `Err` variant, which should be handled
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue