Skip to content

Commit 2810ea9

Browse files
committed
Convert 'again' to 'loop'. Remove 'again' keyword
1 parent 073df63 commit 2810ea9

35 files changed

+56
-56
lines changed

src/cargo/cargo.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -817,7 +817,7 @@ fn install_source(c: cargo, path: &Path) {
817817

818818
for cratefiles.each |cf| {
819819
match load_crate(&cf) {
820-
None => again,
820+
None => loop,
821821
Some(crate) => {
822822
for crate.deps.each |query| {
823823
// FIXME (#1356): handle cyclic dependencies

src/fuzzer/fuzzer.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -562,18 +562,18 @@ fn check_variants(files: &[Path], cx: context) {
562562
file_might_not_converge(&file) {
563563
error!("Skipping convergence test based on\
564564
file_might_not_converge");
565-
again;
565+
loop;
566566
}
567567

568568
let s = @result::get(io::read_whole_file_str(&file));
569569
if contains(*s, ~"#") {
570-
again; // Macros are confusing
570+
loop; // Macros are confusing
571571
}
572572
if cx.mode == tm_converge && content_might_not_converge(*s) {
573-
again;
573+
loop;
574574
}
575575
if cx.mode == tm_run && content_is_dangerous_to_compile(*s) {
576-
again;
576+
loop;
577577
}
578578
579579
log(error, ~"check_variants: " + file.to_str());

src/libcore/gc.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ unsafe fn walk_gc_roots(mem: Memory, sentinel: **Word, visitor: Visitor) {
218218
last_ret = *ptr::offset(frame.fp, ret_offset) as *Word;
219219

220220
if ptr::is_null(pc) {
221-
again;
221+
loop;
222222
}
223223

224224
let mut delay_reached_sentinel = reached_sentinel;
@@ -231,13 +231,13 @@ unsafe fn walk_gc_roots(mem: Memory, sentinel: **Word, visitor: Visitor) {
231231
if root == sentinel {
232232
delay_reached_sentinel = true;
233233
}
234-
again;
234+
loop;
235235
}
236236

237237
// Skip null pointers, which can occur when a
238238
// unique pointer has already been freed.
239239
if ptr::is_null(*root) {
240-
again;
240+
loop;
241241
}
242242

243243
if ptr::is_null(tydesc) {
@@ -324,7 +324,7 @@ fn cleanup_stack_for_failure() {
324324
for walk_gc_roots(need_cleanup, sentinel) |root, tydesc| {
325325
// Track roots to avoid double frees.
326326
if option::is_some(roots.find(&*root)) {
327-
again;
327+
loop;
328328
}
329329
roots.insert(*root, ());
330330

src/libcore/io.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ impl Reader {
8484
assert (w > 0u);
8585
if w == 1u {
8686
vec::push(chars, b0 as char );
87-
again;
87+
loop;
8888
}
8989
// can't satisfy this char with the existing data
9090
if end > vec::len(buf) {

src/libcore/path.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -419,10 +419,10 @@ pure fn normalize(components: &[~str]) -> ~[~str] {
419419
unchecked {
420420
for components.each |c| {
421421
unchecked {
422-
if c == ~"." && components.len() > 1 { again; }
422+
if c == ~"." && components.len() > 1 { loop; }
423423
if c == ~".." && cs.len() != 0 {
424424
vec::pop(cs);
425-
again;
425+
loop;
426426
}
427427
vec::push(cs, copy c);
428428
}

src/libstd/net_url.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -347,12 +347,12 @@ fn query_to_str(+query: Query) -> ~str {
347347
fn get_scheme(rawurl: &str) -> result::Result<(~str, ~str), @~str> {
348348
for str::each_chari(rawurl) |i,c| {
349349
match c {
350-
'A' .. 'Z' | 'a' .. 'z' => again,
350+
'A' .. 'Z' | 'a' .. 'z' => loop,
351351
'0' .. '9' | '+' | '-' | '.' => {
352352
if i == 0 {
353353
return result::Err(@~"url: Scheme must begin with a letter.");
354354
}
355-
again;
355+
loop;
356356
}
357357
':' => {
358358
if i == 0 {
@@ -419,7 +419,7 @@ fn get_authority(rawurl: &str) ->
419419
let mut pos : uint = 0, begin : uint = 2, end : uint = len;
420420

421421
for str::each_chari(rawurl) |i,c| {
422-
if i < 2 { again; } // ignore the leading //
422+
if i < 2 { loop; } // ignore the leading //
423423

424424
// deal with input class first
425425
match c {
@@ -569,7 +569,7 @@ fn get_path(rawurl: &str, authority : bool) ->
569569
'A' .. 'Z' | 'a' .. 'z' | '0' .. '9' | '&' |'\'' | '(' | ')' | '.'
570570
| '@' | ':' | '%' | '/' | '+' | '!' | '*' | ',' | ';' | '='
571571
| '_' | '-' => {
572-
again;
572+
loop;
573573
}
574574
'?' | '#' => {
575575
end = i;

src/libstd/rope.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1171,7 +1171,7 @@ mod node {
11711171
option::Some(_) => {
11721172
let next_char = get_next_char_in_leaf(it);
11731173
match (next_char) {
1174-
option::None => again,
1174+
option::None => loop,
11751175
option::Some(_) => return next_char
11761176
}
11771177
}

src/libsyntax/ext/simplext.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -719,7 +719,7 @@ fn add_new_extension(cx: ext_ctxt, sp: span, arg: ast::mac_arg,
719719
for clauses.each |c| {
720720
match use_selectors_to_bind(c.params, arg) {
721721
Some(bindings) => return transcribe(cx, bindings, c.body),
722-
None => again
722+
None => loop
723723
}
724724
}
725725
cx.span_fatal(sp, ~"no clauses match macro invocation");

src/libsyntax/parse/comments.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ fn strip_doc_comment_decoration(comment: ~str) -> ~str {
5555
let mut i = max.get_default(uint::max_value);
5656
for lines.each |line| {
5757
if line.trim().is_empty() {
58-
again;
58+
loop;
5959
}
6060
for line.each_chari |j, c| {
6161
if j >= i {

src/libsyntax/parse/lexer.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,7 @@ fn scan_digits(rdr: string_reader, radix: uint) -> ~str {
306306
let mut rslt = ~"";
307307
loop {
308308
let c = rdr.curr;
309-
if c == '_' { bump(rdr); again; }
309+
if c == '_' { bump(rdr); loop; }
310310
match char::to_digit(c, radix) {
311311
Some(_) => {
312312
str::push_char(rslt, c);

src/libsyntax/parse/parser.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -888,7 +888,7 @@ struct parser {
888888
return pexpr(self.parse_sugary_call_expr(~"do", expr_do_body));
889889
} else if self.eat_keyword(~"while") {
890890
return pexpr(self.parse_while_expr());
891-
} else if self.eat_keyword(~"again") || self.eat_keyword(~"loop") {
891+
} else if self.eat_keyword(~"loop") {
892892
return pexpr(self.parse_loop_expr());
893893
} else if self.eat_keyword(~"match") {
894894
return pexpr(self.parse_alt_expr());
@@ -1138,7 +1138,7 @@ struct parser {
11381138
}
11391139
_ => self.unexpected()
11401140
}
1141-
again;
1141+
loop;
11421142
}
11431143
if self.expr_is_complete(e) { break; }
11441144
match copy self.token {
@@ -3096,7 +3096,7 @@ struct parser {
30963096
}
30973097
self.expect(token::LBRACE);
30983098
common_fields = Some(self.parse_struct_def());
3099-
again;
3099+
loop;
31003100
}
31013101

31023102
let vis = self.parse_visibility();

src/libsyntax/parse/token.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -412,7 +412,7 @@ fn contextual_keyword_table() -> hashmap<~str, ()> {
412412
fn restricted_keyword_table() -> hashmap<~str, ()> {
413413
let words = str_hash();
414414
let keys = ~[
415-
~"again", ~"assert",
415+
~"assert",
416416
~"break",
417417
~"const", ~"copy",
418418
~"do", ~"drop",

src/libsyntax/print/pprust.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1323,7 +1323,7 @@ fn print_expr(s: ps, &&expr: @ast::expr) {
13231323
option::iter(opt_ident, |ident| {print_ident(s, ident); space(s.s)});
13241324
}
13251325
ast::expr_again(opt_ident) => {
1326-
word(s.s, ~"again");
1326+
word(s.s, ~"loop");
13271327
space(s.s);
13281328
option::iter(opt_ident, |ident| {print_ident(s, ident); space(s.s)});
13291329
}

src/rustc/back/link.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -687,7 +687,7 @@ fn link_binary(sess: session,
687687
for cstore::get_used_crate_files(cstore).each |cratepath| {
688688
if cratepath.filetype() == Some(~"rlib") {
689689
vec::push(cc_args, cratepath.to_str());
690-
again;
690+
loop;
691691
}
692692
let dir = cratepath.dirname();
693693
if dir != ~"" { vec::push(cc_args, ~"-L" + dir); }

src/rustc/metadata/encoder.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -772,7 +772,7 @@ fn encode_info_for_item(ecx: @encode_ctxt, ebml_w: ebml::Writer, item: @item,
772772
// maybe we should only ever handle the real type signatures.
773773
for vec::each(ms) |m| {
774774
let ty_m = ast_util::trait_method_to_ty_method(m);
775-
if ty_m.self_ty.node != ast::sty_static { again; }
775+
if ty_m.self_ty.node != ast::sty_static { loop; }
776776

777777
vec::push(*index, {val: ty_m.id, pos: ebml_w.writer.tell()});
778778

src/rustc/middle/borrowck/check_loans.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ impl check_loan_ctxt {
266266
for self.walk_loans(par_scope_id) |old_loan| {
267267
for (*new_loanss).each |new_loans| {
268268
for (*new_loans).each |new_loan| {
269-
if old_loan.lp != new_loan.lp { again; }
269+
if old_loan.lp != new_loan.lp { loop; }
270270
match (old_loan.mutbl, new_loan.mutbl) {
271271
(m_const, _) | (_, m_const) |
272272
(m_mutbl, m_mutbl) | (m_imm, m_imm) => {

src/rustc/middle/kind.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ fn check_fn(fk: visit::fn_kind, decl: fn_decl, body: blk, sp: span,
199199
let id = ast_util::def_id_of_def(fv.def).node;
200200

201201
// skip over free variables that appear in the cap clause
202-
if captured_vars.contains(id) { again; }
202+
if captured_vars.contains(id) { loop; }
203203

204204
// if this is the last use of the variable, then it will be
205205
// a move and not a copy

src/rustc/middle/lang_items.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ struct LanguageItemCollector {
193193
}
194194
dl_def(_) | dl_impl(_) | dl_field => {
195195
// Skip this.
196-
again;
196+
loop;
197197
}
198198
}
199199

src/rustc/middle/privacy.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ fn check_crate(tcx: ty::ctxt, method_map: &method_map, crate: @ast::crate) {
3636
let check_field = |span, id, ident| {
3737
let fields = ty::lookup_class_fields(tcx, id);
3838
for fields.each |field| {
39-
if field.ident != ident { again; }
39+
if field.ident != ident { loop; }
4040
if field.vis == private {
4141
tcx.sess.span_err(span, fmt!("field `%s` is private",
4242
*tcx.sess.parse_sess.interner

src/rustc/middle/resolve.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2156,7 +2156,7 @@ struct Resolver {
21562156
if !self.name_is_exported(containing_module, atom) {
21572157
debug!("(resolving glob import) name `%s` is unexported",
21582158
self.session.str_of(atom));
2159-
again;
2159+
loop;
21602160
}
21612161

21622162
debug!("(resolving glob import) writing module resolution \
@@ -2220,7 +2220,7 @@ struct Resolver {
22202220
if !self.name_is_exported(containing_module, atom) {
22212221
debug!("(resolving glob import) name `%s` is unexported",
22222222
self.session.str_of(atom));
2223-
again;
2223+
loop;
22242224
}
22252225

22262226
let mut dest_import_resolution;

src/rustc/middle/trans/base.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2537,7 +2537,7 @@ fn crate_ctxt_to_encode_parms(cx: @crate_ctxt)
25372537
let mut reexports = ~[];
25382538
for cx.exp_map.each |exp_id, defs| {
25392539
for defs.each |def| {
2540-
if !def.reexp { again; }
2540+
if !def.reexp { loop; }
25412541
let path = match cx.tcx.items.get(exp_id) {
25422542
ast_map::node_export(_, path) => {
25432543
ast_map::path_to_str(*path, cx.sess.parse_sess.interner)

src/rustc/middle/trans/foreign.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,7 @@ fn llreg_ty(cls: ~[x86_64_reg_class]) -> TypeRef {
305305
vec_len as c_uint);
306306
vec::push(tys, vec_ty);
307307
i += vec_len;
308-
again;
308+
loop;
309309
}
310310
sse_fs_class => {
311311
vec::push(tys, T_f32());

src/rustc/middle/typeck/check/alt.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -381,7 +381,7 @@ fn check_pat(pcx: pat_ctxt, pat: @ast::pat, expected: ty::t) {
381381
if !etc {
382382
for class_fields.eachi |i, field| {
383383
if found_fields.contains_key(i) {
384-
again;
384+
loop;
385385
}
386386
tcx.sess.span_err(pat.span,
387387
fmt!("pattern does not mention field `%s`",

src/rustc/middle/typeck/check/method.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,7 @@ struct lookup {
298298
let (trait_id, bound_substs) = match bound {
299299
ty::bound_copy | ty::bound_send | ty::bound_const |
300300
ty::bound_owned => {
301-
again; /* ok */
301+
loop; /* ok */
302302
}
303303
ty::bound_trait(bound_t) => {
304304
match ty::get(bound_t).struct {
@@ -352,7 +352,7 @@ struct lookup {
352352

353353
let ms = *ty::trait_methods(self.tcx(), did);
354354
for ms.eachi |i, m| {
355-
if m.ident != self.m_name { again; }
355+
if m.ident != self.m_name { loop; }
356356

357357
let m_fty = ty::mk_fn(self.tcx(), m.fty);
358358

@@ -391,7 +391,7 @@ struct lookup {
391391
let ms = *ty::trait_methods(self.tcx(), did);
392392

393393
for ms.each |m| {
394-
if m.ident != self.m_name { again; }
394+
if m.ident != self.m_name { loop; }
395395

396396
if m.vis == ast::private && !self.include_private {
397397
self.tcx().sess.span_fatal(

src/rustc/middle/typeck/check/vtable.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ fn lookup_vtable(fcx: @fn_ctxt,
183183

184184
// First, ensure we haven't processed this impl yet.
185185
if impls_seen.contains_key(im.did) {
186-
again;
186+
loop;
187187
}
188188
impls_seen.insert(im.did, ());
189189

@@ -208,7 +208,7 @@ fn lookup_vtable(fcx: @fn_ctxt,
208208
match ty::get(of_ty).struct {
209209
ty::ty_trait(id, _, _) => {
210210
// Not the trait we're looking for
211-
if id != trait_id { again; }
211+
if id != trait_id { loop; }
212212
}
213213
_ => { /* ok */ }
214214
}
@@ -233,7 +233,7 @@ fn lookup_vtable(fcx: @fn_ctxt,
233233
let im_bs = ty::lookup_item_type(tcx,
234234
im.did).bounds;
235235
match fcx.mk_subty(false, expr.span, ty, for_ty) {
236-
result::Err(_) => again,
236+
result::Err(_) => loop,
237237
result::Ok(()) => ()
238238
}
239239

src/rustc/middle/typeck/coherence.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -659,7 +659,7 @@ struct CoherenceChecker {
659659
}
660660
Some(_) => {
661661
// Skip this one.
662-
again;
662+
loop;
663663
}
664664
}
665665

@@ -741,7 +741,7 @@ struct CoherenceChecker {
741741
}
742742
dl_def(_) | dl_impl(_) | dl_field => {
743743
// Skip this.
744-
again;
744+
loop;
745745
}
746746
}
747747

src/test/bench/shootout-k-nucleotide-pipes.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ fn main(args: ~[~str]) {
166166
while !rdr.eof() {
167167
let line: ~str = rdr.read_line();
168168
169-
if str::len(line) == 0u { again; }
169+
if str::len(line) == 0u { loop; }
170170
171171
match (line[0], proc_mode) {
172172

src/test/bench/shootout-k-nucleotide.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ fn main(args: ~[~str]) {
154154
while !rdr.eof() {
155155
let line: ~str = rdr.read_line();
156156
157-
if str::len(line) == 0u { again; }
157+
if str::len(line) == 0u { loop; }
158158
159159
match (line[0], proc_mode) {
160160

0 commit comments

Comments
 (0)