blob: 33a865d6769cabfa3f40362161a1f75669c9fb47 [file] [log] [blame]
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:69: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:71: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:73: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:75: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:78: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:84: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:88: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:92: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:96: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