Skip to content

Commit 5af58e7

Browse files
committed
Removed all 4 uses of do ... while in the codebase.
1 parent fa6c18e commit 5af58e7

File tree

2 files changed

+11
-8
lines changed

2 files changed

+11
-8
lines changed

src/libcore/path.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ fn normalize(p: path) -> path {
251251
let mut t = [];
252252
let mut i = vec::len(s);
253253
let mut skip = 0;
254-
do {
254+
while i != 0u {
255255
i -= 1u;
256256
if s[i] == ".." {
257257
skip += 1;
@@ -262,7 +262,7 @@ fn normalize(p: path) -> path {
262262
skip -= 1;
263263
}
264264
}
265-
} while i != 0u;
265+
}
266266
let mut t = vec::reversed(t);
267267
while skip > 0 {
268268
t += [".."];

src/rustc/metadata/tydecode.rs

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -69,10 +69,11 @@ fn parse_constrs(st: @pstate, conv: conv_did) -> [@ty::constr] {
6969
let mut rslt: [@ty::constr] = [];
7070
alt peek(st) {
7171
':' {
72-
do {
72+
loop {
7373
next(st);
7474
rslt += [parse_constr(st, conv, parse_constr_arg)];
75-
} while peek(st) == ';'
75+
if peek(st) != ';' { break; }
76+
}
7677
}
7778
_ { }
7879
}
@@ -84,10 +85,11 @@ fn parse_ty_constrs(st: @pstate, conv: conv_did) -> [@ty::type_constr] {
8485
let mut rslt: [@ty::type_constr] = [];
8586
alt peek(st) {
8687
':' {
87-
do {
88+
loop {
8889
next(st);
8990
rslt += [parse_constr(st, conv, parse_ty_constr_arg)];
90-
} while peek(st) == ';'
91+
if peek(st) != ';' { break; }
92+
}
9193
}
9294
_ { }
9395
}
@@ -154,12 +156,13 @@ fn parse_constr<T: copy>(st: @pstate, conv: conv_did,
154156
assert (ignore == '(');
155157
let def = parse_def(st, conv);
156158
let mut an_arg: constr_arg_general_<T>;
157-
do {
159+
loop {
158160
an_arg = pser(st);
159161
// FIXME use a real span
160162
args += [@respan(sp, an_arg)];
161163
ignore = next(st);
162-
} while ignore == ';'
164+
if ignore != ';' { break; }
165+
}
163166
assert (ignore == ')');
164167
ret @respan(sp, {path: pth, args: args, id: def});
165168
}

0 commit comments

Comments
 (0)