Skip to content

Commit 4f67dcb

Browse files
committed
Migrate users of 'loop' to 'continue'
Closes #9467
1 parent 4af849b commit 4f67dcb

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+78
-78
lines changed

src/libextra/base64.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ impl<'self> FromBase64 for &'self str {
200200
'0'..'9' => buf |= val + 0x04,
201201
'+'|'-' => buf |= 0x3E,
202202
'/'|'_' => buf |= 0x3F,
203-
'\r'|'\n' => loop,
203+
'\r'|'\n' => continue,
204204
'=' => break,
205205
_ => return Err(format!("Invalid character '{}' at position {}",
206206
self.char_at(idx), idx))

src/libextra/fileinput.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,7 @@ impl io::Reader for FileInput {
303303
let b = r.read_byte();
304304

305305
if b < 0 {
306-
loop;
306+
continue;
307307
}
308308

309309
if b == '\n' as int {

src/libextra/glob.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ impl Pattern {
211211
let cs = parse_char_specifiers(chars.slice(i + 2, i + 3 + j));
212212
tokens.push(AnyExcept(cs));
213213
i += j + 4;
214-
loop;
214+
continue;
215215
}
216216
}
217217
}
@@ -222,7 +222,7 @@ impl Pattern {
222222
let cs = parse_char_specifiers(chars.slice(i + 1, i + 2 + j));
223223
tokens.push(AnyWithin(cs));
224224
i += j + 3;
225-
loop;
225+
continue;
226226
}
227227
}
228228
}

src/libextra/hex.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ impl<'self> FromHex for &'self str {
100100
'0'..'9' => buf |= byte - ('0' as u8),
101101
' '|'\r'|'\n'|'\t' => {
102102
buf >>= 4;
103-
loop
103+
continue
104104
}
105105
_ => return Err(format!("Invalid character '{}' at position {}",
106106
self.char_at(idx), idx))

src/libextra/num/bigint.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -413,7 +413,7 @@ impl Integer for BigUint {
413413
}
414414
if d0.is_zero() {
415415
n = 2;
416-
loop;
416+
continue;
417417
}
418418
n = 1;
419419
// FIXME(#6102): Assignment operator for BigInt causes ICE

src/libextra/priority_queue.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ impl<T:Ord> PriorityQueue<T> {
140140
let x = replace(&mut self.data[parent], init());
141141
move_val_init(&mut self.data[pos], x);
142142
pos = parent;
143-
loop
143+
continue
144144
}
145145
break
146146
}

src/libextra/terminfo/parser/compiled.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ pub fn parse(file: @Reader, longnames: bool) -> Result<~TermInfo, ~str> {
276276
for (i, v) in string_offsets.iter().enumerate() {
277277
let offset = *v;
278278
if offset == 0xFFFF { // non-entry
279-
loop;
279+
continue;
280280
}
281281

282282
let name = if snames[i] == "_" {
@@ -289,7 +289,7 @@ pub fn parse(file: @Reader, longnames: bool) -> Result<~TermInfo, ~str> {
289289
// undocumented: FFFE indicates cap@, which means the capability is not present
290290
// unsure if the handling for this is correct
291291
string_map.insert(name.to_owned(), ~[]);
292-
loop;
292+
continue;
293293
}
294294

295295

src/libextra/url.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -359,12 +359,12 @@ pub fn query_to_str(query: &Query) -> ~str {
359359
pub fn get_scheme(rawurl: &str) -> Result<(~str, ~str), ~str> {
360360
for (i,c) in rawurl.iter().enumerate() {
361361
match c {
362-
'A' .. 'Z' | 'a' .. 'z' => loop,
362+
'A' .. 'Z' | 'a' .. 'z' => continue,
363363
'0' .. '9' | '+' | '-' | '.' => {
364364
if i == 0 {
365365
return Err(~"url: Scheme must begin with a letter.");
366366
}
367-
loop;
367+
continue;
368368
}
369369
':' => {
370370
if i == 0 {
@@ -420,7 +420,7 @@ fn get_authority(rawurl: &str) ->
420420
let mut end = len;
421421

422422
for (i,c) in rawurl.iter().enumerate() {
423-
if i < 2 { loop; } // ignore the leading //
423+
if i < 2 { continue; } // ignore the leading //
424424

425425
// deal with input class first
426426
match c {
@@ -558,7 +558,7 @@ fn get_path(rawurl: &str, authority: bool) ->
558558
'A' .. 'Z' | 'a' .. 'z' | '0' .. '9' | '&' |'\'' | '(' | ')' | '.'
559559
| '@' | ':' | '%' | '/' | '+' | '!' | '*' | ',' | ';' | '='
560560
| '_' | '-' => {
561-
loop;
561+
continue;
562562
}
563563
'?' | '#' => {
564564
end = i;

src/librust/rust.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ pub fn main() {
247247
os::set_exit_status(exit_code);
248248
return;
249249
}
250-
_ => loop
250+
_ => {}
251251
}
252252
}
253253
}

src/librustc/back/link.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1004,7 +1004,7 @@ pub fn link_args(sess: Session,
10041004
for cratepath in r.iter() {
10051005
if cratepath.filetype() == Some(".rlib") {
10061006
args.push(cratepath.to_str());
1007-
loop;
1007+
continue;
10081008
}
10091009
let dir = cratepath.dirname();
10101010
if dir != ~"" { args.push(~"-L" + dir); }

src/librustc/middle/borrowck/check_loans.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -263,8 +263,8 @@ impl<'self> CheckLoanCtxt<'self> {
263263
debug2!("illegal_if={:?}", illegal_if);
264264

265265
for restr in loan1.restrictions.iter() {
266-
if !restr.set.intersects(illegal_if) { loop; }
267-
if restr.loan_path != loan2.loan_path { loop; }
266+
if !restr.set.intersects(illegal_if) { continue; }
267+
if restr.loan_path != loan2.loan_path { continue; }
268268

269269
match (new_loan.mutbl, old_loan.mutbl) {
270270
(MutableMutability, MutableMutability) => {

src/librustc/middle/lint.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -613,7 +613,7 @@ pub fn each_lint(sess: session::Session,
613613
ast::MetaList(_, ref metas) => metas,
614614
_ => {
615615
sess.span_err(meta.span, "malformed lint attribute");
616-
loop;
616+
continue;
617617
}
618618
};
619619
for meta in metas.iter() {

src/librustc/middle/privacy.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ impl PrivacyVisitor {
225225
fn check_field(&mut self, span: Span, id: ast::DefId, ident: ast::Ident) {
226226
let fields = ty::lookup_struct_fields(self.tcx, id);
227227
for field in fields.iter() {
228-
if field.name != ident.name { loop; }
228+
if field.name != ident.name { continue; }
229229
if field.vis == private {
230230
self.tcx.sess.span_err(span, format!("field `{}` is private",
231231
token::ident_to_str(&ident)));

src/librustc/middle/reachable.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -359,7 +359,7 @@ impl ReachableContext {
359359
while self.worklist.len() > 0 {
360360
let search_item = self.worklist.pop();
361361
if scanned.contains(&search_item) {
362-
loop
362+
continue
363363
}
364364
scanned.insert(search_item);
365365
self.reachable_symbols.insert(search_item);

src/librustc/middle/resolve.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3334,7 +3334,7 @@ impl Resolver {
33343334
if importresolution.privacy != Public {
33353335
debug2!("(computing exports) not reexporting private `{}`",
33363336
interner_get(*name));
3337-
loop;
3337+
continue;
33383338
}
33393339
let xs = [TypeNS, ValueNS];
33403340
for ns in xs.iter() {

src/librustc/middle/trans/cabi_x86_64.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,7 @@ fn llreg_ty(cls: &[RegClass]) -> Type {
317317
let vec_ty = Type::vector(&Type::f32(), (vec_len * 2u) as u64);
318318
tys.push(vec_ty);
319319
i += vec_len;
320-
loop;
320+
continue;
321321
}
322322
SSEFs => {
323323
tys.push(Type::f32());

src/librustc/middle/typeck/astconv.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -799,7 +799,7 @@ fn conv_builtin_bounds(tcx: ty::ctxt, ast_bounds: &Option<OptVec<ast::TyParamBou
799799
ast::DefTrait(trait_did) => {
800800
if ty::try_add_builtin_trait(tcx, trait_did,
801801
&mut builtin_bounds) {
802-
loop; // success
802+
continue; // success
803803
}
804804
}
805805
_ => { }

src/librustc/middle/typeck/check/_match.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,7 @@ pub fn check_struct_pat_fields(pcx: &pat_ctxt,
330330
if !etc {
331331
for (i, field) in class_fields.iter().enumerate() {
332332
if found_fields.contains(&i) {
333-
loop;
333+
continue;
334334
}
335335
tcx.sess.span_err(span,
336336
format!("pattern does not mention field `{}`",

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -922,7 +922,7 @@ impl<'self> LookupContext<'self> {
922922

923923
if skip {
924924
// There are more than one of these and we need only one
925-
loop;
925+
continue;
926926
} else {
927927
merged.push(candidate_a.clone());
928928
}

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,7 @@ fn search_for_vtable(vcx: &VtableContext,
338338

339339
// First, ensure we haven't processed this impl yet.
340340
if impls_seen.contains(&im.did) {
341-
loop;
341+
continue;
342342
}
343343
impls_seen.insert(im.did);
344344

@@ -349,7 +349,7 @@ fn search_for_vtable(vcx: &VtableContext,
349349
// get all the ty vars sorted out.
350350
let r = ty::impl_trait_ref(tcx, im.did);
351351
let of_trait_ref = r.expect("trait_ref missing on trait impl");
352-
if of_trait_ref.def_id != trait_ref.def_id { loop; }
352+
if of_trait_ref.def_id != trait_ref.def_id { continue; }
353353

354354
// At this point, we know that of_trait_ref is the same trait
355355
// as trait_ref, but possibly applied to different substs.
@@ -377,7 +377,7 @@ fn search_for_vtable(vcx: &VtableContext,
377377
location_info.span),
378378
ty,
379379
for_ty) {
380-
result::Err(_) => loop,
380+
result::Err(_) => continue,
381381
result::Ok(()) => ()
382382
}
383383

src/librustc/middle/typeck/coherence.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -558,7 +558,7 @@ impl CoherenceChecker {
558558
let r = ty::trait_methods(tcx, trait_did);
559559
for method in r.iter() {
560560
debug2!("checking for {}", method.ident.repr(tcx));
561-
if provided_names.contains(&method.ident.name) { loop; }
561+
if provided_names.contains(&method.ident.name) { continue; }
562562

563563
tcx.sess.span_err(trait_ref_span,
564564
format!("missing method `{}`",
@@ -730,7 +730,7 @@ impl CoherenceChecker {
730730
for impl_info in impls.iter() {
731731
if impl_info.methods.len() < 1 {
732732
// We'll error out later. For now, just don't ICE.
733-
loop;
733+
continue;
734734
}
735735
let method_def_id = impl_info.methods[0].def_id;
736736

src/librustc/middle/typeck/infer/region_inference/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -919,15 +919,15 @@ impl RegionVarBindings {
919919
ConstrainVarSubVar(*) |
920920
ConstrainRegSubVar(*) |
921921
ConstrainVarSubReg(*) => {
922-
loop;
922+
continue;
923923
}
924924
ConstrainRegSubReg(sub, sup) => {
925925
(sub, sup)
926926
}
927927
};
928928

929929
if self.is_subregion_of(sub, sup) {
930-
loop;
930+
continue;
931931
}
932932

933933
debug2!("ConcreteFailure: !(sub <= sup): sub={:?}, sup={:?}",

src/librustc/middle/typeck/infer/sub.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -199,10 +199,10 @@ impl Combine for Sub {
199199
// or new variables:
200200
match *tainted_region {
201201
ty::re_infer(ty::ReVar(ref vid)) => {
202-
if new_vars.iter().any(|x| x == vid) { loop; }
202+
if new_vars.iter().any(|x| x == vid) { continue; }
203203
}
204204
_ => {
205-
if *tainted_region == skol { loop; }
205+
if *tainted_region == skol { continue; }
206206
}
207207
};
208208

src/librustdoc/html/render.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ fn clean_srcpath(src: &str, f: &fn(&str)) {
225225
let p = Path(src);
226226
for c in p.components.iter() {
227227
if "." == *c {
228-
loop
228+
continue
229229
}
230230
if ".." == *c {
231231
f("up");
@@ -928,7 +928,7 @@ fn item_module(w: &mut io::Writer, cx: &Context,
928928
}
929929

930930
_ => {
931-
if myitem.name.is_none() { loop }
931+
if myitem.name.is_none() { continue }
932932
write!(w, "
933933
<tr>
934934
<td><a class='{class}' href='{href}'
@@ -1276,15 +1276,15 @@ fn render_impl(w: &mut io::Writer, i: &clean::Impl, dox: &Option<~str>) {
12761276
match meth.doc_value() {
12771277
Some(s) => {
12781278
write!(w, "<div class='docblock'>{}</div>", Markdown(s));
1279-
loop
1279+
continue
12801280
}
12811281
None => {}
12821282
}
12831283

12841284
// No documentation? Attempt to slurp in the trait's documentation
12851285
let trait_id = match trait_id {
1286-
None => loop,
1287-
Some(id) if is_local(id) => loop,
1286+
None => continue,
1287+
Some(id) if is_local(id) => continue,
12881288
Some(id) => id.node,
12891289
};
12901290
do local_data::get(cache_key) |cache| {
@@ -1369,7 +1369,7 @@ fn build_sidebar(m: &clean::Module) -> HashMap<~str, ~[~str]> {
13691369
for item in m.items.iter() {
13701370
let short = shortty(item);
13711371
let myname = match item.name {
1372-
None => loop,
1372+
None => continue,
13731373
Some(ref s) => s.to_owned(),
13741374
};
13751375
let v = map.find_or_insert_with(short.to_owned(), |_| ~[]);

src/librustdoc/rustdoc.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ fn rust_input(cratefile: &str, matches: &getopts::Matches) -> Output {
234234
Some(i) => PASSES[i].n1(),
235235
None => {
236236
error2!("unknown pass {}, skipping", *pass);
237-
loop
237+
continue
238238
},
239239
};
240240
pm.add_plugin(plugin);

src/librusti/rusti.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -569,7 +569,7 @@ pub fn main_args(args: &[~str]) -> int {
569569
if istty {
570570
println("()");
571571
}
572-
loop;
572+
continue;
573573
}
574574
run_line(&mut repl, input, out, line, istty);
575575
}

src/librustpkg/path_util.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ fn library_in(short_name: &str, version: &Version, dir_to_search: &Path) -> Opti
233233
// Find a filename that matches the pattern: (lib_prefix)-hash-(version)(lib_suffix)
234234
// and remember what the hash was
235235
let mut f_name = match p_path.filestem() {
236-
Some(s) => s, None => loop
236+
Some(s) => s, None => continue
237237
};
238238
// Already checked the filetype above
239239

src/librustpkg/version.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,15 +101,15 @@ pub fn try_getting_local_version(local_path: &Path) -> Option<Version> {
101101
let local_path = rp.push_rel(local_path);
102102
let git_dir = local_path.push(".git");
103103
if !os::path_is_dir(&git_dir) {
104-
loop;
104+
continue;
105105
}
106106
let outp = run::process_output("git",
107107
[format!("--git-dir={}", git_dir.to_str()), ~"tag", ~"-l"]);
108108

109109
debug2!("git --git-dir={} tag -l ~~~> {:?}", git_dir.to_str(), outp.status);
110110

111111
if outp.status != 0 {
112-
loop;
112+
continue;
113113
}
114114

115115
let mut output = None;

src/libstd/io.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -665,7 +665,7 @@ impl<T:Reader> ReaderUtil for T {
665665
unsafe {
666666
chars.push(transmute(b0 as u32));
667667
}
668-
loop;
668+
continue;
669669
}
670670
// can't satisfy this char with the existing data
671671
if end > bytes_len {

0 commit comments

Comments
 (0)