blob: 325f75dd572be6ca1b0957ce65d5d070d86c66b6 [file]
error: called `map(<f>).unwrap_or_else(<g>)` on an `Option` value
--> tests/ui/map_unwrap_or_fixable.rs:16: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:47: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:61: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:63: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:65: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:67: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:70: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:76: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:80: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:84: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:88: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