blob: 90bb625d7a2aebd293a5a07b93b9fc2848d7f26e [file]
error: called `map(<f>).unwrap_or_else(<g>)` on an `Option` value
--> tests/ui/map_unwrap_or_fixable.rs:21:13
|
LL | let _ = opt.map(|x| x + 1)
| _____________^
... |
LL | | .unwrap_or_else(|| 0);
| |_____________________________^ help: try: `opt.map_or_else(|| 0, |x| x + 1)`
|
= note: `-D clippy::map-unwrap-or` implied by `-D warnings`
= help: to override `-D warnings` add `#[allow(clippy::map_unwrap_or)]`
error: called `map(<f>).unwrap_or_else(<g>)` on a `Result` value
--> tests/ui/map_unwrap_or_fixable.rs:52:13
|
LL | let _ = res.map(|x| x + 1)
| _____________^
... |
LL | | .unwrap_or_else(|_e| 0);
| |_______________________________^ help: try: `res.map_or_else(|_e| 0, |x| x + 1)`
error: called `map(<f>).unwrap_or(<a>)` on an `Option` value
--> tests/ui/map_unwrap_or_fixable.rs:66:20
|
LL | println!("{}", o.map(|y| y + 1).unwrap_or(3));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
help: use `map_or(<a>, <f>)` instead
|
LL - println!("{}", o.map(|y| y + 1).unwrap_or(3));
LL + println!("{}", o.map_or(3, |y| y + 1));
|
error: called `map(<f>).unwrap_or_else(<g>)` on an `Option` value
--> tests/ui/map_unwrap_or_fixable.rs:68:20
|
LL | println!("{}", o.map(|y| y + 1).unwrap_or_else(|| 3));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `o.map_or_else(|| 3, |y| y + 1)`
error: called `map(<f>).unwrap_or(<a>)` on a `Result` value
--> tests/ui/map_unwrap_or_fixable.rs:70:20
|
LL | println!("{}", r.map(|y| y + 1).unwrap_or(3));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
help: use `map_or(<a>, <f>)` instead
|
LL - println!("{}", r.map(|y| y + 1).unwrap_or(3));
LL + println!("{}", r.map_or(3, |y| y + 1));
|
error: called `map(<f>).unwrap_or_else(<g>)` on a `Result` value
--> tests/ui/map_unwrap_or_fixable.rs:72:20
|
LL | println!("{}", r.map(|y| y + 1).unwrap_or_else(|()| 3));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `r.map_or_else(|()| 3, |y| y + 1)`
error: called `map(<f>).unwrap_or(false)` on a `Result` value
--> tests/ui/map_unwrap_or_fixable.rs:75:20
|
LL | println!("{}", r.map(|y| y == 1).unwrap_or(false));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
help: use `is_ok_and(<f>)` instead
|
LL - println!("{}", r.map(|y| y == 1).unwrap_or(false));
LL + println!("{}", r.is_ok_and(|y| y == 1));
|
error: called `map(<f>).unwrap_or(<a>)` on an `Option` value
--> tests/ui/map_unwrap_or_fixable.rs:81:20
|
LL | println!("{}", x.map(|y| y + 1).unwrap_or(3));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
help: use `map_or(<a>, <f>)` instead
|
LL - println!("{}", x.map(|y| y + 1).unwrap_or(3));
LL + println!("{}", x.map_or(3, |y| y + 1));
|
error: called `map(<f>).unwrap_or(<a>)` on a `Result` value
--> tests/ui/map_unwrap_or_fixable.rs:85:20
|
LL | println!("{}", x.map(|y| y + 1).unwrap_or(3));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
help: use `map_or(<a>, <f>)` instead
|
LL - println!("{}", x.map(|y| y + 1).unwrap_or(3));
LL + println!("{}", x.map_or(3, |y| y + 1));
|
error: called `map(<f>).unwrap_or_else(<g>)` on an `Option` value
--> tests/ui/map_unwrap_or_fixable.rs:89:20
|
LL | println!("{}", x.map(|y| y + 1).unwrap_or_else(|| 3));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `x.map_or_else(|| 3, |y| y + 1)`
error: called `map(<f>).unwrap_or_else(<g>)` on a `Result` value
--> tests/ui/map_unwrap_or_fixable.rs:93:20
|
LL | println!("{}", x.map(|y| y + 1).unwrap_or_else(|_| 3));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `x.map_or_else(|_| 3, |y| y + 1)`
error: aborting due to 11 previous errors