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