Skip to content

Commit

Permalink
Removed all 4 uses of do ... while in the codebase.
Browse files Browse the repository at this point in the history
  • Loading branch information
paulstansifer committed May 10, 2012
1 parent fa6c18e commit 5af58e7
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
4 changes: 2 additions & 2 deletions src/libcore/path.rs
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ fn normalize(p: path) -> path {
let mut t = [];
let mut i = vec::len(s);
let mut skip = 0;
do {
while i != 0u {
i -= 1u;
if s[i] == ".." {
skip += 1;
Expand All @@ -262,7 +262,7 @@ fn normalize(p: path) -> path {
skip -= 1;
}
}
} while i != 0u;
}
let mut t = vec::reversed(t);
while skip > 0 {
t += [".."];
Expand Down
15 changes: 9 additions & 6 deletions src/rustc/metadata/tydecode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,11 @@ fn parse_constrs(st: @pstate, conv: conv_did) -> [@ty::constr] {
let mut rslt: [@ty::constr] = [];
alt peek(st) {
':' {
do {
loop {
next(st);
rslt += [parse_constr(st, conv, parse_constr_arg)];
} while peek(st) == ';'
if peek(st) != ';' { break; }
}
}
_ { }
}
Expand All @@ -84,10 +85,11 @@ fn parse_ty_constrs(st: @pstate, conv: conv_did) -> [@ty::type_constr] {
let mut rslt: [@ty::type_constr] = [];
alt peek(st) {
':' {
do {
loop {
next(st);
rslt += [parse_constr(st, conv, parse_ty_constr_arg)];
} while peek(st) == ';'
if peek(st) != ';' { break; }
}
}
_ { }
}
Expand Down Expand Up @@ -154,12 +156,13 @@ fn parse_constr<T: copy>(st: @pstate, conv: conv_did,
assert (ignore == '(');
let def = parse_def(st, conv);
let mut an_arg: constr_arg_general_<T>;
do {
loop {
an_arg = pser(st);
// FIXME use a real span
args += [@respan(sp, an_arg)];
ignore = next(st);
} while ignore == ';'
if ignore != ';' { break; }
}
assert (ignore == ')');
ret @respan(sp, {path: pth, args: args, id: def});
}
Expand Down

0 comments on commit 5af58e7

Please sign in to comment.