]> git.lizzy.rs Git - rust.git/commitdiff
use enumerate in place of 'for ti in range(i, tokens.len()) ... match tokens[ti]...
authorTim Kuehn <tkuehn@cmu.edu>
Sat, 7 Sep 2013 01:36:48 +0000 (21:36 -0400)
committerTim Kuehn <tkuehn@cmu.edu>
Sat, 7 Sep 2013 01:54:03 +0000 (21:54 -0400)
src/libextra/glob.rs

index 6f58102e00a45607640af6001563a985f2eaf639..d82c1fd35c2ce8823aef51878db758038d1d0f3a 100644 (file)
@@ -304,11 +304,11 @@ fn matches_from(&self,
              && is_sep(prev_char.unwrap_or_default('/')))
         };
 
-        for ti in range(i, self.tokens.len()) {
-            match self.tokens[ti] {
+        for (ti, token) in self.tokens.slice_from(i).iter().enumerate() {
+            match *token {
                 AnySequence => {
                     loop {
-                        match self.matches_from(prev_char, file, ti + 1, options) {
+                        match self.matches_from(prev_char, file, i + ti + 1, options) {
                             SubPatternDoesntMatch => (), // keep trying
                             m => return m,
                         }
@@ -331,7 +331,7 @@ fn matches_from(&self,
                     }
 
                     let (c, next) = file.slice_shift_char();
-                    let matches = match self.tokens[ti] {
+                    let matches = match *token {
                         AnyChar => {
                             !require_literal(c)
                         }