Skip to content

Commit 058551c

Browse files
committed
Add function call to test
1 parent 3c768ad commit 058551c

File tree

2 files changed

+18
-4
lines changed

2 files changed

+18
-4
lines changed

src/test/ui/lint/must_use-tuple.rs

+6
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,15 @@
11
#![deny(unused_must_use)]
22

3+
fn foo() -> Result<(), ()> {
4+
Ok::<(), ()>(())
5+
}
6+
37
fn main() {
48
(Ok::<(), ()>(()),); //~ ERROR unused `std::result::Result` that must be used
59

610
(Ok::<(), ()>(()), 0, Ok::<(), ()>(()), 5);
711
//~^ ERROR unused `std::result::Result` that must be used
812
//~^^ ERROR unused `std::result::Result` that must be used
13+
14+
foo(); //~ ERROR unused `std::result::Result` that must be used
915
}

src/test/ui/lint/must_use-tuple.stderr

+12-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error: unused `std::result::Result` that must be used
2-
--> $DIR/must_use-tuple.rs:4:6
2+
--> $DIR/must_use-tuple.rs:8:6
33
|
44
LL | (Ok::<(), ()>(()),);
55
| ^^^^^^^^^^^^^^^^
@@ -12,20 +12,28 @@ LL | #![deny(unused_must_use)]
1212
= note: this `Result` may be an `Err` variant, which should be handled
1313

1414
error: unused `std::result::Result` that must be used
15-
--> $DIR/must_use-tuple.rs:6:6
15+
--> $DIR/must_use-tuple.rs:10:6
1616
|
1717
LL | (Ok::<(), ()>(()), 0, Ok::<(), ()>(()), 5);
1818
| ^^^^^^^^^^^^^^^^
1919
|
2020
= note: this `Result` may be an `Err` variant, which should be handled
2121

2222
error: unused `std::result::Result` that must be used
23-
--> $DIR/must_use-tuple.rs:6:27
23+
--> $DIR/must_use-tuple.rs:10:27
2424
|
2525
LL | (Ok::<(), ()>(()), 0, Ok::<(), ()>(()), 5);
2626
| ^^^^^^^^^^^^^^^^
2727
|
2828
= note: this `Result` may be an `Err` variant, which should be handled
2929

30-
error: aborting due to 3 previous errors
30+
error: unused `std::result::Result` that must be used
31+
--> $DIR/must_use-tuple.rs:14:5
32+
|
33+
LL | foo();
34+
| ^^^^^^
35+
|
36+
= note: this `Result` may be an `Err` variant, which should be handled
37+
38+
error: aborting due to 4 previous errors
3139

0 commit comments

Comments
 (0)