]> git.lizzy.rs Git - rust.git/blob - tests/ui/matches.stderr
Merge pull request #1919 from rust-lang-nursery/ui
[rust.git] / tests / ui / matches.stderr
1 error: you seem to be trying to use match for destructuring a single pattern. Consider using `if let`
2   --> $DIR/matches.rs:26:5
3    |
4 26 | /     match ExprNode::Butterflies {
5 27 | |         ExprNode::ExprAddrOf => Some(&NODE),
6 28 | |         _ => { let x = 5; None },
7 29 | |     }
8    | |_____^ help: try this: `if let ExprNode::ExprAddrOf = ExprNode::Butterflies { Some(&NODE) } else { let x = 5; None }`
9    |
10    = note: `-D single-match-else` implied by `-D warnings`
11
12 error: you seem to be trying to use match for destructuring a single pattern. Consider using `if let`
13   --> $DIR/matches.rs:35:5
14    |
15 35 | /     match x {
16 36 | |         Some(y) => { println!("{:?}", y); }
17 37 | |         _ => ()
18 38 | |     };
19    | |_____^ help: try this: `if let Some(y) = x { println!("{:?}", y); }`
20    |
21    = note: `-D single-match` implied by `-D warnings`
22
23 error: you seem to be trying to use match for destructuring a single pattern. Consider using `if let`
24   --> $DIR/matches.rs:41:5
25    |
26 41 | /     match z {
27 42 | |         (2...3, 7...9) => dummy(),
28 43 | |         _ => {}
29 44 | |     };
30    | |_____^ help: try this: `if let (2...3, 7...9) = z { dummy() }`
31
32 error: you seem to be trying to use match for destructuring a single pattern. Consider using `if let`
33   --> $DIR/matches.rs:63:5
34    |
35 63 | /     match x {
36 64 | |         Some(y) => dummy(),
37 65 | |         None => ()
38 66 | |     };
39    | |_____^ help: try this: `if let Some(y) = x { dummy() }`
40
41 error: you seem to be trying to use match for destructuring a single pattern. Consider using `if let`
42   --> $DIR/matches.rs:68:5
43    |
44 68 | /     match y {
45 69 | |         Ok(y) => dummy(),
46 70 | |         Err(..) => ()
47 71 | |     };
48    | |_____^ help: try this: `if let Ok(y) = y { dummy() }`
49
50 error: you seem to be trying to use match for destructuring a single pattern. Consider using `if let`
51   --> $DIR/matches.rs:75:5
52    |
53 75 | /     match c {
54 76 | |         Cow::Borrowed(..) => dummy(),
55 77 | |         Cow::Owned(..) => (),
56 78 | |     };
57    | |_____^ help: try this: `if let Cow::Borrowed(..) = c { dummy() }`
58
59 error: you seem to be trying to match on a boolean expression
60   --> $DIR/matches.rs:96:5
61    |
62 96 | /     match test {
63 97 | |         true => 0,
64 98 | |         false => 42,
65 99 | |     };
66    | |_____^ help: consider using an if/else expression: `if test { 0 } else { 42 }`
67    |
68    = note: `-D match-bool` implied by `-D warnings`
69
70 error: you seem to be trying to match on a boolean expression
71    --> $DIR/matches.rs:102:5
72     |
73 102 | /     match option == 1 {
74 103 | |         true => 1,
75 104 | |         false => 0,
76 105 | |     };
77     | |_____^ help: consider using an if/else expression: `if option == 1 { 1 } else { 0 }`
78
79 error: you seem to be trying to match on a boolean expression
80    --> $DIR/matches.rs:107:5
81     |
82 107 | /     match test {
83 108 | |         true => (),
84 109 | |         false => { println!("Noooo!"); }
85 110 | |     };
86     | |_____^ help: consider using an if/else expression: `if !test { println!("Noooo!"); }`
87
88 error: you seem to be trying to match on a boolean expression
89    --> $DIR/matches.rs:112:5
90     |
91 112 | /     match test {
92 113 | |         false => { println!("Noooo!"); }
93 114 | |         _ => (),
94 115 | |     };
95     | |_____^ help: consider using an if/else expression: `if !test { println!("Noooo!"); }`
96
97 error: you seem to be trying to match on a boolean expression
98    --> $DIR/matches.rs:117:5
99     |
100 117 | /     match test && test {
101 118 | |         false => { println!("Noooo!"); }
102 119 | |         _ => (),
103 120 | |     };
104     | |_____^ help: consider using an if/else expression: `if !(test && test) { println!("Noooo!"); }`
105
106 error: equal expressions as operands to `&&`
107    --> $DIR/matches.rs:117:11
108     |
109 117 |     match test && test {
110     |           ^^^^^^^^^^^^
111     |
112     = note: `-D eq-op` implied by `-D warnings`
113
114 error: you seem to be trying to match on a boolean expression
115    --> $DIR/matches.rs:122:5
116     |
117 122 | /     match test {
118 123 | |         false => { println!("Noooo!"); }
119 124 | |         true => { println!("Yes!"); }
120 125 | |     };
121     | |_____^ help: consider using an if/else expression: `if test { println!("Yes!"); } else { println!("Noooo!"); }`
122
123 error: you don't need to add `&` to all patterns
124    --> $DIR/matches.rs:138:9
125     |
126 138 | /         match v {
127 139 | |             &Some(v) => println!("{:?}", v),
128 140 | |             &None => println!("none"),
129 141 | |         }
130     | |_________^
131     |
132     = note: `-D match-ref-pats` implied by `-D warnings`
133 help: instead of prefixing all patterns with `&`, you can dereference the expression
134     |
135 138 |         match *v { .. }
136     |         ^^^^^^^^^^^^^^^
137
138 error: you don't need to add `&` to all patterns
139    --> $DIR/matches.rs:148:5
140     |
141 148 | /     match tup {
142 149 | |         &(v, 1) => println!("{}", v),
143 150 | |         _ => println!("none"),
144 151 | |     }
145     | |_____^
146     |
147 help: instead of prefixing all patterns with `&`, you can dereference the expression
148     |
149 148 |     match *tup { .. }
150     |     ^^^^^^^^^^^^^^^^^
151
152 error: you don't need to add `&` to both the expression and the patterns
153    --> $DIR/matches.rs:154:5
154     |
155 154 | /     match &w {
156 155 | |         &Some(v) => println!("{:?}", v),
157 156 | |         &None => println!("none"),
158 157 | |     }
159     | |_____^ help: try: `match w { .. }`
160
161 error: you don't need to add `&` to all patterns
162    --> $DIR/matches.rs:165:5
163     |
164 165 | /     if let &None = a {
165 166 | |         println!("none");
166 167 | |     }
167     | |_____^
168     |
169 help: instead of prefixing all patterns with `&`, you can dereference the expression
170     |
171 165 |     if let .. = *a { .. }
172     |     ^^^^^^^^^^^^^^^^^^^^^
173
174 error: you don't need to add `&` to both the expression and the patterns
175    --> $DIR/matches.rs:170:5
176     |
177 170 | /     if let &None = &b {
178 171 | |         println!("none");
179 172 | |     }
180     | |_____^ help: try: `if let .. = b { .. }`
181
182 error: some ranges overlap
183    --> $DIR/matches.rs:179:9
184     |
185 179 |         0 ... 10 => println!("0 ... 10"),
186     |         ^^^^^^^^
187     |
188     = note: `-D match-overlapping-arm` implied by `-D warnings`
189 note: overlaps with this
190    --> $DIR/matches.rs:180:9
191     |
192 180 |         0 ... 11 => println!("0 ... 11"),
193     |         ^^^^^^^^
194
195 error: some ranges overlap
196    --> $DIR/matches.rs:185:9
197     |
198 185 |         0 ... 5 => println!("0 ... 5"),
199     |         ^^^^^^^
200     |
201 note: overlaps with this
202    --> $DIR/matches.rs:187:9
203     |
204 187 |         FOO ... 11 => println!("0 ... 11"),
205     |         ^^^^^^^^^^
206
207 error: some ranges overlap
208    --> $DIR/matches.rs:193:9
209     |
210 193 |         0 ... 5 => println!("0 ... 5"),
211     |         ^^^^^^^
212     |
213 note: overlaps with this
214    --> $DIR/matches.rs:192:9
215     |
216 192 |         2 => println!("2"),
217     |         ^
218
219 error: some ranges overlap
220    --> $DIR/matches.rs:199:9
221     |
222 199 |         0 ... 2 => println!("0 ... 2"),
223     |         ^^^^^^^
224     |
225 note: overlaps with this
226    --> $DIR/matches.rs:198:9
227     |
228 198 |         2 => println!("2"),
229     |         ^
230
231 error: some ranges overlap
232    --> $DIR/matches.rs:222:9
233     |
234 222 |         0 .. 11 => println!("0 .. 11"),
235     |         ^^^^^^^
236     |
237 note: overlaps with this
238    --> $DIR/matches.rs:223:9
239     |
240 223 |         0 ... 11 => println!("0 ... 11"),
241     |         ^^^^^^^^
242
243 error: Err(_) will match all errors, maybe not a good idea
244    --> $DIR/matches.rs:240:9
245     |
246 240 |         Err(_) => panic!("err")
247     |         ^^^^^^
248     |
249     = note: `-D match-wild-err-arm` implied by `-D warnings`
250     = note: to remove this warning, match each error seperately or use unreachable macro
251
252 error: Err(_) will match all errors, maybe not a good idea
253    --> $DIR/matches.rs:246:9
254     |
255 246 |         Err(_) => {panic!()}
256     |         ^^^^^^
257     |
258     = note: to remove this warning, match each error seperately or use unreachable macro
259
260 error: Err(_) will match all errors, maybe not a good idea
261    --> $DIR/matches.rs:252:9
262     |
263 252 |         Err(_) => {panic!();}
264     |         ^^^^^^
265     |
266     = note: to remove this warning, match each error seperately or use unreachable macro
267
268 error: aborting due to 26 previous errors
269