@@ -1075,13 +1075,13 @@ fn pick_col(m: &[Match]) -> uint {
1075
1075
}
1076
1076
let mut scores = vec:: from_elem ( m[ 0 ] . pats . len ( ) , 0 u) ;
1077
1077
for br in m. iter ( ) {
1078
- let mut i = 0 u;
1079
- for p in br. pats . iter ( ) { scores[ i] += score ( * p) ; i += 1 u; }
1078
+ for ( i, p) in br. pats . iter ( ) . enumerate ( ) {
1079
+ scores[ i] += score ( * p) ;
1080
+ }
1080
1081
}
1081
1082
let mut max_score = 0 u;
1082
1083
let mut best_col = 0 u;
1083
- let mut i = 0 u;
1084
- for score in scores. iter ( ) {
1084
+ for ( i, score) in scores. iter ( ) . enumerate ( ) {
1085
1085
let score = * score;
1086
1086
1087
1087
// Irrefutable columns always go first, they'd only be duplicated in
@@ -1090,7 +1090,6 @@ fn pick_col(m: &[Match]) -> uint {
1090
1090
// If no irrefutable ones are found, we pick the one with the biggest
1091
1091
// branching factor.
1092
1092
if score > max_score { max_score = score; best_col = i; }
1093
- i += 1 u;
1094
1093
}
1095
1094
return best_col;
1096
1095
}
@@ -1490,13 +1489,11 @@ fn compile_submatch_continue(mut bcx: @mut Block,
1490
1489
let defaults = enter_default ( else_cx, dm, m, col, val) ;
1491
1490
let exhaustive = chk. is_none ( ) && defaults. len ( ) == 0 u;
1492
1491
let len = opts. len ( ) ;
1493
- let mut i = 0 u;
1494
1492
1495
1493
// Compile subtrees for each option
1496
- for opt in opts. iter ( ) {
1497
- i += 1 u;
1494
+ for ( i, opt) in opts. iter ( ) . enumerate ( ) {
1498
1495
let mut opt_cx = else_cx;
1499
- if !exhaustive || i < len {
1496
+ if !exhaustive || i+ 1 < len {
1500
1497
opt_cx = sub_block ( bcx, "match_case" ) ;
1501
1498
match kind {
1502
1499
single => Br ( bcx, opt_cx. llbb ) ,
0 commit comments