]> git.proxmox.com Git - rustc.git/blob - src/tools/clippy/tests/ui/unwrap_in_result.stderr
New upstream version 1.66.0+dfsg1
[rustc.git] / src / tools / clippy / tests / ui / unwrap_in_result.stderr
1 error: used unwrap or expect in a function that returns result or option
2 --> $DIR/unwrap_in_result.rs:22:5
3 |
4 LL | / fn bad_divisible_by_3(i_str: String) -> Result<bool, String> {
5 LL | | // checks whether a string represents a number divisible by 3
6 LL | | let i = i_str.parse::<i32>().unwrap();
7 LL | | if i % 3 == 0 {
8 ... |
9 LL | | }
10 LL | | }
11 | |_____^
12 |
13 = help: unwrap and expect should not be used in a function that returns result or option
14 note: potential non-recoverable error(s)
15 --> $DIR/unwrap_in_result.rs:24:17
16 |
17 LL | let i = i_str.parse::<i32>().unwrap();
18 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
19 = note: `-D clippy::unwrap-in-result` implied by `-D warnings`
20
21 error: used unwrap or expect in a function that returns result or option
22 --> $DIR/unwrap_in_result.rs:32:5
23 |
24 LL | / fn example_option_expect(i_str: String) -> Option<bool> {
25 LL | | let i = i_str.parse::<i32>().expect("not a number");
26 LL | | if i % 3 == 0 {
27 LL | | return Some(true);
28 LL | | }
29 LL | | None
30 LL | | }
31 | |_____^
32 |
33 = help: unwrap and expect should not be used in a function that returns result or option
34 note: potential non-recoverable error(s)
35 --> $DIR/unwrap_in_result.rs:33:17
36 |
37 LL | let i = i_str.parse::<i32>().expect("not a number");
38 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
39
40 error: aborting due to 2 previous errors
41