]> git.lizzy.rs Git - rust.git/blob - tests/ui/result_map_unwrap_or_else.stderr
UI test cleanup: Extract lint from methods.rs test
[rust.git] / tests / ui / result_map_unwrap_or_else.stderr
1 error: called `map(f).unwrap_or_else(g)` on a Result value. This can be done more directly by calling `ok().map_or_else(g, f)` instead
2   --> $DIR/result_map_unwrap_or_else.rs:21:13
3    |
4 LL |       let _ = res.map(|x| x + 1)
5    |  _____________^
6 LL | |
7 LL | |                .unwrap_or_else(|e| 0); // should lint even though this call is on a separate line
8    | |_____________________________________^
9    |
10    = note: `-D clippy::result-map-unwrap-or-else` implied by `-D warnings`
11    = note: replace `map(|x| x + 1).unwrap_or_else(|e| 0)` with `ok().map_or_else(|e| 0, |x| x + 1)`
12
13 error: called `map(f).unwrap_or_else(g)` on a Result value. This can be done more directly by calling `ok().map_or_else(g, f)` instead
14   --> $DIR/result_map_unwrap_or_else.rs:25:13
15    |
16 LL |       let _ = res.map(|x| {
17    |  _____________^
18 LL | |                         x + 1
19 LL | |                     }
20 LL | |               ).unwrap_or_else(|e| 0);
21    | |_____________________________________^
22
23 error: called `map(f).unwrap_or_else(g)` on a Result value. This can be done more directly by calling `ok().map_or_else(g, f)` instead
24   --> $DIR/result_map_unwrap_or_else.rs:29:13
25    |
26 LL |       let _ = res.map(|x| x + 1)
27    |  _____________^
28 LL | |                .unwrap_or_else(|e|
29 LL | |                     0
30 LL | |                 );
31    | |_________________^
32
33 error: aborting due to 3 previous errors
34