diff options
| author | Huon Wilson <dbau.pp+github@gmail.com> | 2014-04-30 00:55:28 +1000 |
|---|---|---|
| committer | Huon Wilson <dbau.pp+github@gmail.com> | 2014-04-30 10:35:20 +1000 |
| commit | 33f98ada02cccb58f700b1b26059ae63d75917c4 (patch) | |
| tree | 1d6be5fe950a9a8f9e2c6d5f87d9ad6050819290 /src/libregex_macros | |
| parent | de14a739ae27088acaa3c5e21949a39bffd5313b (diff) | |
| download | rust-33f98ada02cccb58f700b1b26059ae63d75917c4.tar.gz rust-33f98ada02cccb58f700b1b26059ae63d75917c4.zip | |
regex: General style tweaks.
For loops are nicer than manual whiles, etc.
Diffstat (limited to 'src/libregex_macros')
| -rw-r--r-- | src/libregex_macros/lib.rs | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/src/libregex_macros/lib.rs b/src/libregex_macros/lib.rs index 5445c5f6761..8b134d5af8b 100644 --- a/src/libregex_macros/lib.rs +++ b/src/libregex_macros/lib.rs @@ -187,18 +187,16 @@ fn exec<'t>(which: ::regex::native::MatchKind, input: &'t str, self.ic = next_ic; next_ic = self.chars.advance(); - let mut i = 0; - while i < clist.size { + for i in range(0, clist.size) { let pc = clist.pc(i); let step_state = self.step(&mut groups, nlist, clist.groups(i), pc); match step_state { StepMatchEarlyReturn => return vec![Some(0u), Some(0u)], - StepMatch => { matched = true; clist.empty() }, + StepMatch => { matched = true; break }, StepContinue => {}, } - i += 1; } ::std::mem::swap(&mut clist, &mut nlist); nlist.empty(); |
