@@ -133,7 +133,7 @@ pub fn raw_pat(p: @pat) -> @pat {
133
133
134
134
pub fn check_exhaustive( cx : @MatchCheckCtxt , sp : span , pats: ~[ @pat] ) {
135
135
assert ( !pats. is_empty ( ) ) ;
136
- let ext = match is_useful ( cx, vec :: map ( pats , |p| ~[ * p] ) , ~[ wild ( ) ] ) {
136
+ let ext = match is_useful ( cx, & pats . map ( |p| ~[ * p] ) , ~[ wild ( ) ] ) {
137
137
not_useful => {
138
138
// This is good, wildcard pattern isn't reachable
139
139
return ;
@@ -165,7 +165,7 @@ pub fn check_exhaustive(cx: @MatchCheckCtxt, sp: span, pats: ~[@pat]) {
165
165
ty::ty_unboxed_vec(*) | ty::ty_evec(*) => {
166
166
match *ctor {
167
167
vec(n) => Some(@fmt!(" vectors of length %u", n)),
168
- _ => None
168
+ _ => None
169
169
}
170
170
}
171
171
_ => None
@@ -205,10 +205,10 @@ pub enum ctor {
205
205
206
206
// Note: is_useful doesn't work on empty types, as the paper notes.
207
207
// So it assumes that v is non-empty.
208
- pub fn is_useful(cx: @MatchCheckCtxt, + m: matrix, + v: &[@pat]) -> useful {
208
+ pub fn is_useful(cx: @MatchCheckCtxt, m: & matrix, v: &[@pat]) -> useful {
209
209
if m.len() == 0u { return useful_; }
210
210
if m[0].len() == 0u { return not_useful; }
211
- let real_pat = match vec:: find(m, |r| r[0].id != 0) {
211
+ let real_pat = match m. find(|r| r[0].id != 0) {
212
212
Some(r) => r[0], None => v[0]
213
213
};
214
214
let left_ty = if real_pat.id == 0 { ty::mk_nil(cx.tcx) }
@@ -264,7 +264,7 @@ pub fn is_useful(cx: @MatchCheckCtxt, +m: matrix, +v: &[@pat]) -> useful {
264
264
}
265
265
Some(ref ctor) => {
266
266
match is_useful(cx,
267
- vec::filter_map(m, |r| default(cx, r)),
267
+ &m.filter_mapped( |r| default(cx, * r)),
268
268
v.tail()) {
269
269
useful_ => useful(left_ty, (/*bad*/copy *ctor)),
270
270
ref u => (/*bad*/copy *u)
@@ -280,15 +280,15 @@ pub fn is_useful(cx: @MatchCheckCtxt, +m: matrix, +v: &[@pat]) -> useful {
280
280
}
281
281
282
282
pub fn is_useful_specialized(cx: @MatchCheckCtxt,
283
- m: matrix,
283
+ m: & matrix,
284
284
v: &[@pat],
285
285
+ctor: ctor,
286
286
arity: uint,
287
287
lty: ty::t)
288
288
-> useful {
289
289
let ms = m.filter_mapped(|r| specialize(cx, *r, ctor, arity, lty));
290
290
let could_be_useful = is_useful(
291
- cx, ms, specialize(cx, v, ctor, arity, lty).get());
291
+ cx, & ms, specialize(cx, v, ctor, arity, lty).get());
292
292
match could_be_useful {
293
293
useful_ => useful(lty, ctor),
294
294
ref u => (/*bad*/copy *u)
@@ -347,7 +347,7 @@ pub fn is_wild(cx: @MatchCheckCtxt, p: @pat) -> bool {
347
347
}
348
348
349
349
pub fn missing_ctor(cx: @MatchCheckCtxt,
350
- m: matrix,
350
+ m: & matrix,
351
351
left_ty: ty::t)
352
352
-> Option<ctor> {
353
353
match ty::get(left_ty).sty {
0 commit comments