]> git.proxmox.com Git - rustc.git/blob - src/tools/clippy/tests/ui/manual_map_option.stderr
New upstream version 1.52.1+dfsg1
[rustc.git] / src / tools / clippy / tests / ui / manual_map_option.stderr
1 error: manual implementation of `Option::map`
2 --> $DIR/manual_map_option.rs:14:5
3 |
4 LL | / match Some(0) {
5 LL | | Some(_) => Some(2),
6 LL | | None::<u32> => None,
7 LL | | };
8 | |_____^ help: try this: `Some(0).map(|_| 2)`
9 |
10 = note: `-D clippy::manual-map` implied by `-D warnings`
11
12 error: manual implementation of `Option::map`
13 --> $DIR/manual_map_option.rs:19:5
14 |
15 LL | / match Some(0) {
16 LL | | Some(x) => Some(x + 1),
17 LL | | _ => None,
18 LL | | };
19 | |_____^ help: try this: `Some(0).map(|x| x + 1)`
20
21 error: manual implementation of `Option::map`
22 --> $DIR/manual_map_option.rs:24:5
23 |
24 LL | / match Some("") {
25 LL | | Some(x) => Some(x.is_empty()),
26 LL | | None => None,
27 LL | | };
28 | |_____^ help: try this: `Some("").map(|x| x.is_empty())`
29
30 error: manual implementation of `Option::map`
31 --> $DIR/manual_map_option.rs:29:5
32 |
33 LL | / if let Some(x) = Some(0) {
34 LL | | Some(!x)
35 LL | | } else {
36 LL | | None
37 LL | | };
38 | |_____^ help: try this: `Some(0).map(|x| !x)`
39
40 error: manual implementation of `Option::map`
41 --> $DIR/manual_map_option.rs:36:5
42 |
43 LL | / match Some(0) {
44 LL | | Some(x) => { Some(std::convert::identity(x)) }
45 LL | | None => { None }
46 LL | | };
47 | |_____^ help: try this: `Some(0).map(std::convert::identity)`
48
49 error: manual implementation of `Option::map`
50 --> $DIR/manual_map_option.rs:41:5
51 |
52 LL | / match Some(&String::new()) {
53 LL | | Some(x) => Some(str::len(x)),
54 LL | | None => None,
55 LL | | };
56 | |_____^ help: try this: `Some(&String::new()).map(|x| str::len(x))`
57
58 error: manual implementation of `Option::map`
59 --> $DIR/manual_map_option.rs:51:5
60 |
61 LL | / match &Some([0, 1]) {
62 LL | | Some(x) => Some(x[0]),
63 LL | | &None => None,
64 LL | | };
65 | |_____^ help: try this: `Some([0, 1]).as_ref().map(|x| x[0])`
66
67 error: manual implementation of `Option::map`
68 --> $DIR/manual_map_option.rs:56:5
69 |
70 LL | / match &Some(0) {
71 LL | | &Some(x) => Some(x * 2),
72 LL | | None => None,
73 LL | | };
74 | |_____^ help: try this: `Some(0).map(|x| x * 2)`
75
76 error: manual implementation of `Option::map`
77 --> $DIR/manual_map_option.rs:61:5
78 |
79 LL | / match Some(String::new()) {
80 LL | | Some(ref x) => Some(x.is_empty()),
81 LL | | _ => None,
82 LL | | };
83 | |_____^ help: try this: `Some(String::new()).as_ref().map(|x| x.is_empty())`
84
85 error: manual implementation of `Option::map`
86 --> $DIR/manual_map_option.rs:66:5
87 |
88 LL | / match &&Some(String::new()) {
89 LL | | Some(x) => Some(x.len()),
90 LL | | _ => None,
91 LL | | };
92 | |_____^ help: try this: `Some(String::new()).as_ref().map(|x| x.len())`
93
94 error: manual implementation of `Option::map`
95 --> $DIR/manual_map_option.rs:71:5
96 |
97 LL | / match &&Some(0) {
98 LL | | &&Some(x) => Some(x + x),
99 LL | | &&_ => None,
100 LL | | };
101 | |_____^ help: try this: `Some(0).map(|x| x + x)`
102
103 error: manual implementation of `Option::map`
104 --> $DIR/manual_map_option.rs:84:9
105 |
106 LL | / match &mut Some(String::new()) {
107 LL | | Some(x) => Some(x.push_str("")),
108 LL | | None => None,
109 LL | | };
110 | |_________^ help: try this: `Some(String::new()).as_mut().map(|x| x.push_str(""))`
111
112 error: manual implementation of `Option::map`
113 --> $DIR/manual_map_option.rs:90:5
114 |
115 LL | / match &mut Some(String::new()) {
116 LL | | Some(ref x) => Some(x.len()),
117 LL | | None => None,
118 LL | | };
119 | |_____^ help: try this: `Some(String::new()).as_ref().map(|x| x.len())`
120
121 error: manual implementation of `Option::map`
122 --> $DIR/manual_map_option.rs:95:5
123 |
124 LL | / match &mut &Some(String::new()) {
125 LL | | Some(x) => Some(x.is_empty()),
126 LL | | &mut _ => None,
127 LL | | };
128 | |_____^ help: try this: `Some(String::new()).as_ref().map(|x| x.is_empty())`
129
130 error: manual implementation of `Option::map`
131 --> $DIR/manual_map_option.rs:100:5
132 |
133 LL | / match Some((0, 1, 2)) {
134 LL | | Some((x, y, z)) => Some(x + y + z),
135 LL | | None => None,
136 LL | | };
137 | |_____^ help: try this: `Some((0, 1, 2)).map(|(x, y, z)| x + y + z)`
138
139 error: manual implementation of `Option::map`
140 --> $DIR/manual_map_option.rs:105:5
141 |
142 LL | / match Some([1, 2, 3]) {
143 LL | | Some([first, ..]) => Some(first),
144 LL | | None => None,
145 LL | | };
146 | |_____^ help: try this: `Some([1, 2, 3]).map(|[first, ..]| first)`
147
148 error: manual implementation of `Option::map`
149 --> $DIR/manual_map_option.rs:110:5
150 |
151 LL | / match &Some((String::new(), "test")) {
152 LL | | Some((x, y)) => Some((y, x)),
153 LL | | None => None,
154 LL | | };
155 | |_____^ help: try this: `Some((String::new(), "test")).as_ref().map(|(x, y)| (y, x))`
156
157 error: manual implementation of `Option::map`
158 --> $DIR/manual_map_option.rs:168:5
159 |
160 LL | / match Some(0) {
161 LL | | Some(x) => Some(vec![x]),
162 LL | | None => None,
163 LL | | };
164 | |_____^ help: try this: `Some(0).map(|x| vec![x])`
165
166 error: manual implementation of `Option::map`
167 --> $DIR/manual_map_option.rs:173:5
168 |
169 LL | / match option_env!("") {
170 LL | | Some(x) => Some(String::from(x)),
171 LL | | None => None,
172 LL | | };
173 | |_____^ help: try this: `option_env!("").map(String::from)`
174
175 error: aborting due to 19 previous errors
176