fork/rust

git clone https://git.julia.blue/fork/rust

borsAuto merge of #103046 - JanBeh:PR_clarify_cmp_terminology, r=workingjubilee3bcad65fbf6

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