Skip to content

Commit c02064d

Browse files
committed
librustc: rename vec::each(var) to var.each
1 parent 841f4ce commit c02064d

File tree

19 files changed

+49
-51
lines changed

19 files changed

+49
-51
lines changed

src/librustc/metadata/encoder.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1084,7 +1084,7 @@ fn encode_index<T>(ebml_w: &mut writer::Encoder,
10841084
for buckets.each |bucket| {
10851085
bucket_locs.push(ebml_w.writer.tell());
10861086
ebml_w.start_tag(tag_index_buckets_bucket);
1087-
for vec::each(**bucket) |elt| {
1087+
for (**bucket).each |elt| {
10881088
ebml_w.start_tag(tag_index_buckets_bucket_elt);
10891089
assert!(elt.pos < 0xffff_ffff);
10901090
writer.write_be_u32(elt.pos as u32);

src/librustc/metadata/tyencode.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ use core::hashmap::HashMap;
1717
use core::io::WriterUtil;
1818
use core::io;
1919
use core::uint;
20-
use core::vec;
2120
use syntax::abi::AbiSet;
2221
use syntax::ast;
2322
use syntax::ast::*;
@@ -398,7 +397,7 @@ fn enc_fn_sig(w: @io::Writer, cx: @ctxt, fsig: &ty::FnSig) {
398397
}
399398

400399
fn enc_bounds(w: @io::Writer, cx: @ctxt, bs: @~[ty::param_bound]) {
401-
for vec::each(*bs) |bound| {
400+
for (*bs).each |bound| {
402401
match *bound {
403402
ty::bound_owned => w.write_char('S'),
404403
ty::bound_copy => w.write_char('C'),

src/librustc/middle/check_match.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -366,7 +366,7 @@ pub fn missing_ctor(cx: @MatchCheckCtxt,
366366
}
367367
let variants = ty::enum_variants(cx.tcx, eid);
368368
if found.len() != (*variants).len() {
369-
for vec::each(*variants) |v| {
369+
for (*variants).each |v| {
370370
if !found.contains(&(variant(v.id))) {
371371
return Some(variant(v.id));
372372
}

src/librustc/middle/kind.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ fn check_fn(
235235
}
236236

237237
fn check_arm(a: &arm, cx: Context, v: visit::vt<Context>) {
238-
for vec::each(a.pats) |p| {
238+
for a.pats.each |p| {
239239
do pat_util::pat_bindings(cx.tcx.def_map, *p) |mode, id, span, _pth| {
240240
if mode == bind_by_copy {
241241
let t = ty::node_id_to_type(cx.tcx, id);

src/librustc/middle/resolve.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4630,7 +4630,7 @@ pub impl Resolver {
46304630
}
46314631
46324632
let mut smallest = 0;
4633-
for vec::eachi(maybes) |i, &other| {
4633+
for maybes.eachi |i, &other| {
46344634
46354635
values[i] = str::levdistance(name, other);
46364636
@@ -4664,7 +4664,7 @@ pub impl Resolver {
46644664
if item.id == node_id {
46654665
match item.node {
46664666
item_struct(class_def, _) => {
4667-
for vec::each(class_def.fields) |field| {
4667+
for class_def.fields.each |field| {
46684668
match field.node.kind {
46694669
unnamed_field => {},
46704670
named_field(ident, _) => {

src/librustc/middle/resolve_stage0.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4681,7 +4681,7 @@ pub impl Resolver {
46814681
}
46824682
46834683
let mut smallest = 0;
4684-
for vec::eachi(maybes) |i, &other| {
4684+
for maybes.eachi |i, &other| {
46854685
46864686
values[i] = str::levdistance(name, other);
46874687
@@ -4715,7 +4715,7 @@ pub impl Resolver {
47154715
if item.id == node_id {
47164716
match item.node {
47174717
item_struct(class_def, _) => {
4718-
for vec::each(class_def.fields) |field| {
4718+
for class_def.fields.each |field| {
47194719
match field.node.kind {
47204720
unnamed_field => {},
47214721
named_field(ident, _) => {

src/librustc/middle/trans/_match.rs

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ pub fn variant_opt(bcx: block, pat_id: ast::node_id)
283283
match ccx.tcx.def_map.get_copy(&pat_id) {
284284
ast::def_variant(enum_id, var_id) => {
285285
let variants = ty::enum_variants(ccx.tcx, enum_id);
286-
for vec::each(*variants) |v| {
286+
for (*variants).each |v| {
287287
if var_id == v.id {
288288
return var(v.disr_val,
289289
adt::represent_node(bcx, pat_id))
@@ -349,7 +349,7 @@ pub fn matches_to_str(bcx: block, m: &[@Match]) -> ~str {
349349
}
350350
351351
pub fn has_nested_bindings(m: &[@Match], col: uint) -> bool {
352-
for vec::each(m) |br| {
352+
for m.each |br| {
353353
match br.pats[col].node {
354354
ast::pat_ident(_, _, Some(_)) => return true,
355355
_ => ()
@@ -418,7 +418,7 @@ pub fn enter_match<'r>(bcx: block,
418418
let _indenter = indenter();
419419
420420
let mut result = ~[];
421-
for vec::each(m) |br| {
421+
for m.each |br| {
422422
match e(br.pats[col]) {
423423
Some(sub) => {
424424
let pats =
@@ -934,7 +934,7 @@ pub fn collect_record_or_struct_fields(bcx: block,
934934
col: uint)
935935
-> ~[ast::ident] {
936936
let mut fields: ~[ast::ident] = ~[];
937-
for vec::each(m) |br| {
937+
for m.each |br| {
938938
match br.pats[col].node {
939939
ast::pat_struct(_, ref fs, _) => {
940940
match ty::get(node_id_type(bcx, br.pats[col].id)).sty {
@@ -973,7 +973,7 @@ pub fn root_pats_as_necessary(mut bcx: block,
973973
col: uint,
974974
val: ValueRef)
975975
-> block {
976-
for vec::each(m) |br| {
976+
for m.each |br| {
977977
let pat_id = br.pats[col].id;
978978
if pat_id != 0 {
979979
let datum = Datum {val: val, ty: node_id_type(bcx, pat_id),
@@ -1042,14 +1042,14 @@ pub fn pick_col(m: &[@Match]) -> uint {
10421042
}
10431043
}
10441044
let mut scores = vec::from_elem(m[0].pats.len(), 0u);
1045-
for vec::each(m) |br| {
1045+
for m.each |br| {
10461046
let mut i = 0u;
1047-
for vec::each(br.pats) |p| { scores[i] += score(*p); i += 1u; }
1047+
for br.pats.each |p| { scores[i] += score(*p); i += 1u; }
10481048
}
10491049
let mut max_score = 0u;
10501050
let mut best_col = 0u;
10511051
let mut i = 0u;
1052-
for vec::each(scores) |score| {
1052+
for scores.each |score| {
10531053
let score = *score;
10541054
10551055
// Irrefutable columns always go first, they'd only be duplicated in
@@ -1306,7 +1306,7 @@ pub fn compile_submatch(bcx: block,
13061306
let ccx = *bcx.fcx.ccx;
13071307
let mut pat_id = 0;
13081308
let mut pat_span = dummy_sp();
1309-
for vec::each(m) |br| {
1309+
for m.each |br| {
13101310
// Find a real id (we're adding placeholder wildcard patterns, but
13111311
// each column is guaranteed to have at least one real pattern)
13121312
if pat_id == 0 {
@@ -1438,7 +1438,7 @@ pub fn compile_submatch(bcx: block,
14381438
}
14391439
}
14401440
}
1441-
for vec::each(opts) |o| {
1441+
for opts.each |o| {
14421442
match *o {
14431443
range(_, _) => { kind = compare; break }
14441444
_ => ()
@@ -1460,7 +1460,7 @@ pub fn compile_submatch(bcx: block,
14601460
let mut i = 0u;
14611461
14621462
// Compile subtrees for each option
1463-
for vec::each(opts) |opt| {
1463+
for opts.each |opt| {
14641464
i += 1u;
14651465
let mut opt_cx = else_cx;
14661466
if !exhaustive || i < len {
@@ -1631,7 +1631,7 @@ pub fn trans_match_inner(scope_cx: block,
16311631
}
16321632
16331633
let mut arm_datas = ~[], matches = ~[];
1634-
for vec::each(arms) |arm| {
1634+
for arms.each |arm| {
16351635
let body = scope_block(bcx, arm.body.info(), ~"case_body");
16361636
16371637
// Create the bindings map, which is a mapping from each binding name
@@ -1670,7 +1670,7 @@ pub fn trans_match_inner(scope_cx: block,
16701670
arm: arm,
16711671
bindings_map: bindings_map};
16721672
arm_datas.push(arm_data);
1673-
for vec::each(arm.pats) |p| {
1673+
for arm.pats.each |p| {
16741674
matches.push(@Match {pats: ~[*p], data: arm_data});
16751675
}
16761676
}
@@ -1793,7 +1793,7 @@ pub fn bind_irrefutable_pat(bcx: block,
17931793
vinfo.disr_val,
17941794
val);
17951795
for sub_pats.each |sub_pat| {
1796-
for vec::eachi(args.vals) |i, argval| {
1796+
for args.vals.eachi |i, argval| {
17971797
bcx = bind_irrefutable_pat(bcx,
17981798
sub_pat[i],
17991799
*argval,

src/librustc/middle/trans/base.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -668,7 +668,7 @@ pub fn iter_structural_ty(cx: block, av: ValueRef, t: ty::t,
668668
ty::ty_struct(*) => {
669669
let repr = adt::represent_type(cx.ccx(), t);
670670
do expr::with_field_tys(cx.tcx(), t, None) |discr, field_tys| {
671-
for vec::eachi(field_tys) |i, field_ty| {
671+
for field_tys.eachi |i, field_ty| {
672672
let llfld_a = adt::trans_field_ptr(cx, repr, av, discr, i);
673673
cx = f(cx, llfld_a, field_ty.mt.ty);
674674
}
@@ -709,7 +709,7 @@ pub fn iter_structural_ty(cx: block, av: ValueRef, t: ty::t,
709709
n_variants);
710710
let next_cx = sub_block(cx, ~"enum-iter-next");
711711

712-
for vec::each(*variants) |variant| {
712+
for (*variants).each |variant| {
713713
let variant_cx =
714714
sub_block(cx, ~"enum-iter-variant-" +
715715
int::to_str(variant.disr_val));
@@ -888,7 +888,7 @@ pub fn need_invoke(bcx: block) -> bool {
888888
match cur.kind {
889889
block_scope(inf) => {
890890
let inf = &mut *inf; // FIXME(#5074) workaround old borrowck
891-
for vec::each(inf.cleanups) |cleanup| {
891+
for inf.cleanups.each |cleanup| {
892892
match *cleanup {
893893
clean(_, cleanup_type) | clean_temp(_, _, cleanup_type) => {
894894
if cleanup_type == normal_exit_and_unwind {
@@ -1391,7 +1391,7 @@ pub fn with_scope_datumblock(bcx: block, opt_node_info: Option<NodeInfo>,
13911391
}
13921392

13931393
pub fn block_locals(b: &ast::blk, it: &fn(@ast::local)) {
1394-
for vec::each(b.node.stmts) |s| {
1394+
for b.node.stmts.each |s| {
13951395
match s.node {
13961396
ast::stmt_decl(d, _) => {
13971397
match d.node {
@@ -1973,7 +1973,7 @@ pub fn trans_enum_variant(ccx: @CrateContext,
19731973
repr, ty_to_str(ccx.tcx, enum_ty));
19741974
19751975
adt::trans_start_init(bcx, repr, fcx.llretptr.get(), disr);
1976-
for vec::eachi(args) |i, va| {
1976+
for args.eachi |i, va| {
19771977
let lldestptr = adt::trans_field_ptr(bcx,
19781978
repr,
19791979
fcx.llretptr.get(),
@@ -2072,7 +2072,7 @@ pub fn trans_tuple_struct(ccx: @CrateContext,
20722072
pub fn trans_enum_def(ccx: @CrateContext, enum_definition: &ast::enum_def,
20732073
id: ast::node_id, vi: @~[ty::VariantInfo],
20742074
i: &mut uint) {
2075-
for vec::each(enum_definition.variants) |variant| {
2075+
for enum_definition.variants.each |variant| {
20762076
let disr_val = vi[*i].disr_val;
20772077
*i += 1;
20782078
@@ -2559,7 +2559,7 @@ pub fn trans_constant(ccx: @CrateContext, it: @ast::item) {
25592559
node: it.id });
25602560
let mut i = 0;
25612561
let path = item_path(ccx, it);
2562-
for vec::each((*enum_definition).variants) |variant| {
2562+
for (*enum_definition).variants.each |variant| {
25632563
let p = vec::append(/*bad*/copy path, ~[
25642564
path_name(variant.node.name),
25652565
path_name(special_idents::descrim)

src/librustc/middle/trans/cabi_x86_64.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ fn classify_ty(ty: TypeRef) -> ~[x86_64_reg_class] {
161161
cls: &mut [x86_64_reg_class], i: uint,
162162
off: uint) {
163163
let mut field_off = off;
164-
for vec::each(tys) |ty| {
164+
for tys.each |ty| {
165165
field_off = align(field_off, *ty);
166166
classify(*ty, cls, i, field_off);
167167
field_off += ty_size(*ty);
@@ -283,7 +283,7 @@ fn classify_ty(ty: TypeRef) -> ~[x86_64_reg_class] {
283283
fn llreg_ty(cls: &[x86_64_reg_class]) -> TypeRef {
284284
fn llvec_len(cls: &[x86_64_reg_class]) -> uint {
285285
let mut len = 1u;
286-
for vec::each(cls) |c| {
286+
for cls.each |c| {
287287
if *c != sseup_class {
288288
break;
289289
}
@@ -370,7 +370,7 @@ fn x86_64_tys(atys: &[TypeRef],
370370

371371
let mut arg_tys = ~[];
372372
let mut attrs = ~[];
373-
for vec::each(atys) |t| {
373+
for atys.each |t| {
374374
let (ty, attr) = x86_64_ty(*t, is_pass_byval, ByValAttribute);
375375
arg_tys.push(ty);
376376
attrs.push(attr);

src/librustc/middle/trans/callee.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -631,7 +631,7 @@ pub fn trans_args(cx: block,
631631
match args {
632632
ArgExprs(arg_exprs) => {
633633
let last = arg_exprs.len() - 1u;
634-
for vec::eachi(arg_exprs) |i, arg_expr| {
634+
for arg_exprs.eachi |i, arg_expr| {
635635
let arg_val = unpack_result!(bcx, {
636636
trans_arg_expr(bcx,
637637
arg_tys[i],

src/librustc/middle/trans/controlflow.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ pub fn trans_block(bcx: block, b: &ast::blk, dest: expr::Dest) -> block {
3434
do block_locals(b) |local| {
3535
bcx = alloc_local(bcx, local);
3636
};
37-
for vec::each(b.node.stmts) |s| {
37+
for b.node.stmts.each |s| {
3838
debuginfo::update_source_pos(bcx, b.span);
3939
bcx = trans_stmt(bcx, *s);
4040
}
@@ -107,7 +107,7 @@ pub fn trans_if(bcx: block,
107107
pub fn join_blocks(parent_bcx: block, in_cxs: &[block]) -> block {
108108
let out = sub_block(parent_bcx, ~"join");
109109
let mut reachable = false;
110-
for vec::each(in_cxs) |bcx| {
110+
for in_cxs.each |bcx| {
111111
if !bcx.unreachable {
112112
Br(*bcx, out.llbb);
113113
reachable = true;

src/librustc/middle/trans/expr.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1264,7 +1264,7 @@ fn trans_adt(bcx: block, repr: &adt::Repr, discr: int,
12641264
}
12651265
}
12661266

1267-
for vec::each(temp_cleanups) |cleanup| {
1267+
for temp_cleanups.each |cleanup| {
12681268
revoke_clean(bcx, *cleanup);
12691269
}
12701270
return bcx;

src/librustc/middle/trans/foreign.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,7 @@ pub fn trans_foreign_mod(ccx: @CrateContext,
294294
Some(abi) => abi,
295295
};
296296

297-
for vec::each(foreign_mod.items) |&foreign_item| {
297+
for foreign_mod.items.each |&foreign_item| {
298298
match foreign_item.node {
299299
ast::foreign_item_fn(*) => {
300300
let id = foreign_item.id;

src/librustc/middle/trans/meth.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ pub fn trans_impl(ccx: @CrateContext, path: path, name: ast::ident,
5151

5252
if !generics.ty_params.is_empty() { return; }
5353
let sub_path = vec::append_one(path, path_name(name));
54-
for vec::each(methods) |method| {
54+
for methods.each |method| {
5555
if method.generics.ty_params.len() == 0u {
5656
let llfn = get_item_val(ccx, method.id);
5757
let path = vec::append_one(/*bad*/copy sub_path,

src/librustc/middle/trans/tvec.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ use util::common::indenter;
2828
use util::ppaux::ty_to_str;
2929

3030
use core::option::None;
31-
use core::vec;
3231
use syntax::ast;
3332
use syntax::codemap;
3433

@@ -395,7 +394,7 @@ pub fn write_content(bcx: block,
395394
add_clean_temp_mem(bcx, lleltptr, vt.unit_ty);
396395
temp_cleanups.push(lleltptr);
397396
}
398-
for vec::each(temp_cleanups) |cleanup| {
397+
for temp_cleanups.each |cleanup| {
399398
revoke_clean(bcx, *cleanup);
400399
}
401400
}

src/librustc/middle/trans/type_use.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ pub fn type_uses_for(ccx: @CrateContext, fn_id: def_id, n_tps: uint)
7777
match ty::get(ty::lookup_item_type(cx.ccx.tcx, fn_id).ty).sty {
7878
ty::ty_bare_fn(ty::BareFnTy {sig: ref sig, _}) |
7979
ty::ty_closure(ty::ClosureTy {sig: ref sig, _}) => {
80-
for vec::each(sig.inputs) |arg| {
80+
for sig.inputs.each |arg| {
8181
type_needs(cx, use_repr, arg.ty);
8282
}
8383
}
@@ -213,7 +213,7 @@ pub fn type_needs_inner(cx: Context,
213213
if list::find(enums_seen, |id| *id == did).is_none() {
214214
let seen = @Cons(did, enums_seen);
215215
for vec::each(*ty::enum_variants(cx.ccx.tcx, did)) |v| {
216-
for vec::each(v.args) |aty| {
216+
for v.args.each |aty| {
217217
let t = ty::subst(cx.ccx.tcx, &(*substs), *aty);
218218
type_needs_inner(cx, use_, t, seen);
219219
}

0 commit comments

Comments
 (0)