]> git.lizzy.rs Git - rust.git/blob - tests/ui/result_map_unwrap_or_else.stderr
Auto merge of #4478 - tsurai:master, r=flip1995
[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:15:13
3    |
4 LL |     let _ = res.map(|x| x + 1).unwrap_or_else(|e| 0); // should lint even though this call is on a separate line
5    |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
6    |
7    = note: `-D clippy::result-map-unwrap-or-else` implied by `-D warnings`
8    = note: replace `map(|x| x + 1).unwrap_or_else(|e| 0)` with `ok().map_or_else(|e| 0, |x| x + 1)`
9
10 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
11   --> $DIR/result_map_unwrap_or_else.rs:17:13
12    |
13 LL |     let _ = res.map(|x| x + 1).unwrap_or_else(|e| 0);
14    |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
15    |
16    = note: replace `map(|x| x + 1).unwrap_or_else(|e| 0)` with `ok().map_or_else(|e| 0, |x| x + 1)`
17
18 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
19   --> $DIR/result_map_unwrap_or_else.rs:18:13
20    |
21 LL |     let _ = res.map(|x| x + 1).unwrap_or_else(|e| 0);
22    |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
23    |
24    = note: replace `map(|x| x + 1).unwrap_or_else(|e| 0)` with `ok().map_or_else(|e| 0, |x| x + 1)`
25
26 error: aborting due to 3 previous errors
27