| error: called `map(<f>).unwrap_or_else(<g>)` on an `Option` value | |
| --> tests/ui/map_unwrap_or_fixable.rs:17: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:48: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:62: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:64: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:66: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:68: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:71: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:77: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: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_else(<g>)` on an `Option` value | |
| --> tests/ui/map_unwrap_or_fixable.rs:85: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: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(_).unwrap_or_default()` on an `Option` value | |
| --> tests/ui/map_unwrap_or_fixable.rs:103:21 | |
| | | |
| LL | let _ = opt.map(|x| x * x).unwrap_or_default(); | |
| | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | |
| | | |
| help: use instead | |
| | | |
| LL - let _ = opt.map(|x| x * x).unwrap_or_default(); | |
| LL + let _ = opt.map_or_default(|x| x * x); | |
| | | |
| error: called `map(_).unwrap_or_default()` on an `Option` value | |
| --> tests/ui/map_unwrap_or_fixable.rs:104:21 | |
| | | |
| LL | let _ = opt.map(|x| vec![x]).unwrap_or_default(); | |
| | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | |
| | | |
| help: use instead | |
| | | |
| LL - let _ = opt.map(|x| vec![x]).unwrap_or_default(); | |
| LL + let _ = opt.map_or_default(|x| vec![x]); | |
| | | |
| error: called `map(_).unwrap_or_default()` on an `Option` value | |
| --> tests/ui/map_unwrap_or_fixable.rs:105:31 | |
| | | |
| LL | let _ = identity!(opt.map(|x| x + 1).unwrap_or_default()); | |
| | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | |
| | | |
| help: use instead | |
| | | |
| LL - let _ = identity!(opt.map(|x| x + 1).unwrap_or_default()); | |
| LL + let _ = identity!(opt.map_or_default(|x| x + 1)); | |
| | | |
| error: called `map(_).unwrap_or_default()` on a `Result` value | |
| --> tests/ui/map_unwrap_or_fixable.rs:110:21 | |
| | | |
| LL | let _ = res.map(|x| x * x).unwrap_or_default(); | |
| | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | |
| | | |
| help: use instead | |
| | | |
| LL - let _ = res.map(|x| x * x).unwrap_or_default(); | |
| LL + let _ = res.map_or_default(|x| x * x); | |
| | | |
| error: called `map(_).unwrap_or_default()` on a `Result` value | |
| --> tests/ui/map_unwrap_or_fixable.rs:111:21 | |
| | | |
| LL | let _ = res.map(|x| vec![x]).unwrap_or_default(); | |
| | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | |
| | | |
| help: use instead | |
| | | |
| LL - let _ = res.map(|x| vec![x]).unwrap_or_default(); | |
| LL + let _ = res.map_or_default(|x| vec![x]); | |
| | | |
| error: called `map(_).unwrap_or_default()` on a `Result` value | |
| --> tests/ui/map_unwrap_or_fixable.rs:112:31 | |
| | | |
| LL | let _ = identity!(res.map(|x| x + 1).unwrap_or_default()); | |
| | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | |
| | | |
| help: use instead | |
| | | |
| LL - let _ = identity!(res.map(|x| x + 1).unwrap_or_default()); | |
| LL + let _ = identity!(res.map_or_default(|x| x + 1)); | |
| | | |
| error: aborting due to 17 previous errors | |