1 error: called `map(<f>).unwrap_or(<a>)` on an `Option` value. This can be done more directly by calling `map_or(<a>, <f>)` instead
2 --> $DIR/map_unwrap_or.rs:16:13
4 LL | let _ = opt.map(|x| x + 1)
6 LL | | // Should lint even though this call is on a separate line.
8 | |_____________________^
10 = note: `-D clippy::map-unwrap-or` implied by `-D warnings`
11 help: use `map_or(<a>, <f>)` instead
13 LL - let _ = opt.map(|x| x + 1)
14 LL + let _ = opt.map_or(0, |x| x + 1);
17 error: called `map(<f>).unwrap_or(<a>)` on an `Option` value. This can be done more directly by calling `map_or(<a>, <f>)` instead
18 --> $DIR/map_unwrap_or.rs:20:13
20 LL | let _ = opt.map(|x| {
24 LL | | ).unwrap_or(0);
25 | |__________________^
27 help: use `map_or(<a>, <f>)` instead
29 LL ~ let _ = opt.map_or(0, |x| {
35 error: called `map(<f>).unwrap_or(<a>)` on an `Option` value. This can be done more directly by calling `map_or(<a>, <f>)` instead
36 --> $DIR/map_unwrap_or.rs:24:13
38 LL | let _ = opt.map(|x| x + 1)
45 help: use `map_or(<a>, <f>)` instead
47 LL ~ let _ = opt.map_or({
52 error: called `map(<f>).unwrap_or(None)` on an `Option` value. This can be done more directly by calling `and_then(<f>)` instead
53 --> $DIR/map_unwrap_or.rs:29:13
55 LL | let _ = opt.map(|x| Some(x + 1)).unwrap_or(None);
56 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
58 help: use `and_then(<f>)` instead
60 LL - let _ = opt.map(|x| Some(x + 1)).unwrap_or(None);
61 LL + let _ = opt.and_then(|x| Some(x + 1));
64 error: called `map(<f>).unwrap_or(None)` on an `Option` value. This can be done more directly by calling `and_then(<f>)` instead
65 --> $DIR/map_unwrap_or.rs:31:13
67 LL | let _ = opt.map(|x| {
71 LL | | ).unwrap_or(None);
72 | |_____________________^
74 help: use `and_then(<f>)` instead
76 LL ~ let _ = opt.and_then(|x| {
82 error: called `map(<f>).unwrap_or(None)` on an `Option` value. This can be done more directly by calling `and_then(<f>)` instead
83 --> $DIR/map_unwrap_or.rs:35:13
87 LL | | .map(|x| Some(x + 1))
88 LL | | .unwrap_or(None);
89 | |________________________^
91 help: use `and_then(<f>)` instead
93 LL - .map(|x| Some(x + 1))
94 LL + .and_then(|x| Some(x + 1));
97 error: called `map(<f>).unwrap_or(<a>)` on an `Option` value. This can be done more directly by calling `map_or(<a>, <f>)` instead
98 --> $DIR/map_unwrap_or.rs:46:13
100 LL | let _ = Some("prefix").map(|p| format!("{}.", p)).unwrap_or(id);
101 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
103 help: use `map_or(<a>, <f>)` instead
105 LL - let _ = Some("prefix").map(|p| format!("{}.", p)).unwrap_or(id);
106 LL + let _ = Some("prefix").map_or(id, |p| format!("{}.", p));
109 error: called `map(<f>).unwrap_or_else(<g>)` on an `Option` value. This can be done more directly by calling `map_or_else(<g>, <f>)` instead
110 --> $DIR/map_unwrap_or.rs:50:13
112 LL | let _ = opt.map(|x| {
116 LL | | ).unwrap_or_else(|| 0);
117 | |__________________________^
119 error: called `map(<f>).unwrap_or_else(<g>)` on an `Option` value. This can be done more directly by calling `map_or_else(<g>, <f>)` instead
120 --> $DIR/map_unwrap_or.rs:54:13
122 LL | let _ = opt.map(|x| x + 1)
124 LL | | .unwrap_or_else(||
129 error: called `map(<f>).unwrap_or_else(<g>)` on a `Result` value. This can be done more directly by calling `.map_or_else(<g>, <f>)` instead
130 --> $DIR/map_unwrap_or.rs:66:13
132 LL | let _ = res.map(|x| {
136 LL | | ).unwrap_or_else(|_e| 0);
137 | |____________________________^
139 error: called `map(<f>).unwrap_or_else(<g>)` on a `Result` value. This can be done more directly by calling `.map_or_else(<g>, <f>)` instead
140 --> $DIR/map_unwrap_or.rs:70:13
142 LL | let _ = res.map(|x| x + 1)
144 LL | | .unwrap_or_else(|_e| {
149 error: aborting due to 11 previous errors