1 error: manual implementation of `Option::map`
2 --> $DIR/manual_map_option.rs:14:5
5 LL | | Some(_) => Some(2),
6 LL | | None::<u32> => None,
8 | |_____^ help: try this: `Some(0).map(|_| 2)`
10 = note: `-D clippy::manual-map` implied by `-D warnings`
12 error: manual implementation of `Option::map`
13 --> $DIR/manual_map_option.rs:19:5
15 LL | / match Some(0) {
16 LL | | Some(x) => Some(x + 1),
19 | |_____^ help: try this: `Some(0).map(|x| x + 1)`
21 error: manual implementation of `Option::map`
22 --> $DIR/manual_map_option.rs:24:5
24 LL | / match Some("") {
25 LL | | Some(x) => Some(x.is_empty()),
28 | |_____^ help: try this: `Some("").map(|x| x.is_empty())`
30 error: manual implementation of `Option::map`
31 --> $DIR/manual_map_option.rs:29:5
33 LL | / if let Some(x) = Some(0) {
38 | |_____^ help: try this: `Some(0).map(|x| !x)`
40 error: manual implementation of `Option::map`
41 --> $DIR/manual_map_option.rs:36:5
43 LL | / match Some(0) {
44 LL | | Some(x) => { Some(std::convert::identity(x)) }
45 LL | | None => { None }
47 | |_____^ help: try this: `Some(0).map(std::convert::identity)`
49 error: manual implementation of `Option::map`
50 --> $DIR/manual_map_option.rs:41:5
52 LL | / match Some(&String::new()) {
53 LL | | Some(x) => Some(str::len(x)),
56 | |_____^ help: try this: `Some(&String::new()).map(|x| str::len(x))`
58 error: manual implementation of `Option::map`
59 --> $DIR/manual_map_option.rs:51:5
61 LL | / match &Some([0, 1]) {
62 LL | | Some(x) => Some(x[0]),
65 | |_____^ help: try this: `Some([0, 1]).as_ref().map(|x| x[0])`
67 error: manual implementation of `Option::map`
68 --> $DIR/manual_map_option.rs:56:5
70 LL | / match &Some(0) {
71 LL | | &Some(x) => Some(x * 2),
74 | |_____^ help: try this: `Some(0).map(|x| x * 2)`
76 error: manual implementation of `Option::map`
77 --> $DIR/manual_map_option.rs:61:5
79 LL | / match Some(String::new()) {
80 LL | | Some(ref x) => Some(x.is_empty()),
83 | |_____^ help: try this: `Some(String::new()).as_ref().map(|x| x.is_empty())`
85 error: manual implementation of `Option::map`
86 --> $DIR/manual_map_option.rs:66:5
88 LL | / match &&Some(String::new()) {
89 LL | | Some(x) => Some(x.len()),
92 | |_____^ help: try this: `Some(String::new()).as_ref().map(|x| x.len())`
94 error: manual implementation of `Option::map`
95 --> $DIR/manual_map_option.rs:71:5
97 LL | / match &&Some(0) {
98 LL | | &&Some(x) => Some(x + x),
101 | |_____^ help: try this: `Some(0).map(|x| x + x)`
103 error: manual implementation of `Option::map`
104 --> $DIR/manual_map_option.rs:84:9
106 LL | / match &mut Some(String::new()) {
107 LL | | Some(x) => Some(x.push_str("")),
110 | |_________^ help: try this: `Some(String::new()).as_mut().map(|x| x.push_str(""))`
112 error: manual implementation of `Option::map`
113 --> $DIR/manual_map_option.rs:90:5
115 LL | / match &mut Some(String::new()) {
116 LL | | Some(ref x) => Some(x.len()),
119 | |_____^ help: try this: `Some(String::new()).as_ref().map(|x| x.len())`
121 error: manual implementation of `Option::map`
122 --> $DIR/manual_map_option.rs:95:5
124 LL | / match &mut &Some(String::new()) {
125 LL | | Some(x) => Some(x.is_empty()),
126 LL | | &mut _ => None,
128 | |_____^ help: try this: `Some(String::new()).as_ref().map(|x| x.is_empty())`
130 error: manual implementation of `Option::map`
131 --> $DIR/manual_map_option.rs:100:5
133 LL | / match Some((0, 1, 2)) {
134 LL | | Some((x, y, z)) => Some(x + y + z),
137 | |_____^ help: try this: `Some((0, 1, 2)).map(|(x, y, z)| x + y + z)`
139 error: manual implementation of `Option::map`
140 --> $DIR/manual_map_option.rs:105:5
142 LL | / match Some([1, 2, 3]) {
143 LL | | Some([first, ..]) => Some(first),
146 | |_____^ help: try this: `Some([1, 2, 3]).map(|[first, ..]| first)`
148 error: manual implementation of `Option::map`
149 --> $DIR/manual_map_option.rs:110:5
151 LL | / match &Some((String::new(), "test")) {
152 LL | | Some((x, y)) => Some((y, x)),
155 | |_____^ help: try this: `Some((String::new(), "test")).as_ref().map(|(x, y)| (y, x))`
157 error: manual implementation of `Option::map`
158 --> $DIR/manual_map_option.rs:168:5
160 LL | / match Some(0) {
161 LL | | Some(x) => Some(vec![x]),
164 | |_____^ help: try this: `Some(0).map(|x| vec![x])`
166 error: manual implementation of `Option::map`
167 --> $DIR/manual_map_option.rs:173:5
169 LL | / match option_env!("") {
170 LL | | Some(x) => Some(String::from(x)),
173 | |_____^ help: try this: `option_env!("").map(String::from)`
175 error: aborting due to 19 previous errors