11error: called `map(<f>).unwrap_or_else(<g>)` on an `Option` value
2- --> tests/ui/map_unwrap_or_fixable.rs:17 :13
2+ --> tests/ui/map_unwrap_or_fixable.rs:21 :13
33 |
44LL | let _ = opt.map(|x| x + 1)
55 | _____________^
@@ -11,7 +11,7 @@ LL | | .unwrap_or_else(|| 0);
1111 = help: to override `-D warnings` add `#[allow(clippy::map_unwrap_or)]`
1212
1313error: called `map(<f>).unwrap_or_else(<g>)` on a `Result` value
14- --> tests/ui/map_unwrap_or_fixable.rs:48 :13
14+ --> tests/ui/map_unwrap_or_fixable.rs:52 :13
1515 |
1616LL | let _ = res.map(|x| x + 1)
1717 | _____________^
@@ -20,7 +20,7 @@ LL | | .unwrap_or_else(|_e| 0);
2020 | |_______________________________^ help: try: `res.map_or_else(|_e| 0, |x| x + 1)`
2121
2222error: called `map(<f>).unwrap_or(<a>)` on an `Option` value
23- --> tests/ui/map_unwrap_or_fixable.rs:65 :20
23+ --> tests/ui/map_unwrap_or_fixable.rs:69 :20
2424 |
2525LL | println!("{}", o.map(|y| y + 1).unwrap_or(3));
2626 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -32,13 +32,13 @@ LL + println!("{}", o.map_or(3, |y| y + 1));
3232 |
3333
3434error: called `map(<f>).unwrap_or_else(<g>)` on an `Option` value
35- --> tests/ui/map_unwrap_or_fixable.rs:67 :20
35+ --> tests/ui/map_unwrap_or_fixable.rs:71 :20
3636 |
3737LL | println!("{}", o.map(|y| y + 1).unwrap_or_else(|| 3));
3838 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `o.map_or_else(|| 3, |y| y + 1)`
3939
4040error: called `map(<f>).unwrap_or(<a>)` on an `Result` value
41- --> tests/ui/map_unwrap_or_fixable.rs:69 :20
41+ --> tests/ui/map_unwrap_or_fixable.rs:73 :20
4242 |
4343LL | println!("{}", r.map(|y| y + 1).unwrap_or(3));
4444 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -50,25 +50,25 @@ LL + println!("{}", r.map_or(3, |y| y + 1));
5050 |
5151
5252error: called `map(<f>).unwrap_or_else(<g>)` on a `Result` value
53- --> tests/ui/map_unwrap_or_fixable.rs:71 :20
53+ --> tests/ui/map_unwrap_or_fixable.rs:75 :20
5454 |
5555LL | println!("{}", r.map(|y| y + 1).unwrap_or_else(|()| 3));
5656 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `r.map_or_else(|()| 3, |y| y + 1)`
5757
58- error: called `map(<f>).unwrap_or(false )` on an `Result` value
59- --> tests/ui/map_unwrap_or_fixable.rs:74 :20
58+ error: called `map(<f>).unwrap_or(<a> )` on an `Result` value
59+ --> tests/ui/map_unwrap_or_fixable.rs:78 :20
6060 |
6161LL | println!("{}", r.map(|y| y == 1).unwrap_or(false));
6262 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
6363 |
64- help: use `is_ok_and( <f>)` instead
64+ help: use `map_or(<a>, <f>)` instead
6565 |
6666LL - println!("{}", r.map(|y| y == 1).unwrap_or(false));
67- LL + println!("{}", r.is_ok_and( |y| y == 1));
67+ LL + println!("{}", r.map_or(false, |y| y == 1));
6868 |
6969
7070error: called `map(<f>).unwrap_or(<a>)` on an `Option` value
71- --> tests/ui/map_unwrap_or_fixable.rs:80 :20
71+ --> tests/ui/map_unwrap_or_fixable.rs:84 :20
7272 |
7373LL | println!("{}", x.map(|y| y + 1).unwrap_or(3));
7474 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -80,7 +80,7 @@ LL + println!("{}", x.map_or(3, |y| y + 1));
8080 |
8181
8282error: called `map(<f>).unwrap_or(<a>)` on an `Result` value
83- --> tests/ui/map_unwrap_or_fixable.rs:84 :20
83+ --> tests/ui/map_unwrap_or_fixable.rs:88 :20
8484 |
8585LL | println!("{}", x.map(|y| y + 1).unwrap_or(3));
8686 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -92,13 +92,13 @@ LL + println!("{}", x.map_or(3, |y| y + 1));
9292 |
9393
9494error: called `map(<f>).unwrap_or_else(<g>)` on an `Option` value
95- --> tests/ui/map_unwrap_or_fixable.rs:88 :20
95+ --> tests/ui/map_unwrap_or_fixable.rs:92 :20
9696 |
9797LL | println!("{}", x.map(|y| y + 1).unwrap_or_else(|| 3));
9898 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `x.map_or_else(|| 3, |y| y + 1)`
9999
100100error: called `map(<f>).unwrap_or_else(<g>)` on a `Result` value
101- --> tests/ui/map_unwrap_or_fixable.rs:92 :20
101+ --> tests/ui/map_unwrap_or_fixable.rs:96 :20
102102 |
103103LL | println!("{}", x.map(|y| y + 1).unwrap_or_else(|_| 3));
104104 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `x.map_or_else(|_| 3, |y| y + 1)`
0 commit comments