diff options
| author | Brian Anderson <banderson@mozilla.com> | 2012-06-26 13:55:56 -0700 |
|---|---|---|
| committer | Brian Anderson <banderson@mozilla.com> | 2012-06-30 16:01:49 -0700 |
| commit | a3382b6f26e582210a3b649c9a71badaef0530bf (patch) | |
| tree | bd30506542a14a132b09aae154417c7cc9312498 /src/libsyntax | |
| parent | 8b2491160d71aa7a84ed822b85e9b3eff6097225 (diff) | |
| download | rust-a3382b6f26e582210a3b649c9a71badaef0530bf.tar.gz rust-a3382b6f26e582210a3b649c9a71badaef0530bf.zip | |
Eliminate usages of old sugared call syntax
Diffstat (limited to 'src/libsyntax')
| -rw-r--r-- | src/libsyntax/ast_map.rs | 8 | ||||
| -rw-r--r-- | src/libsyntax/ast_util.rs | 18 | ||||
| -rw-r--r-- | src/libsyntax/attr.rs | 4 | ||||
| -rw-r--r-- | src/libsyntax/diagnostic.rs | 2 | ||||
| -rw-r--r-- | src/libsyntax/ext/auto_serialize.rs | 42 | ||||
| -rw-r--r-- | src/libsyntax/ext/expand.rs | 4 | ||||
| -rw-r--r-- | src/libsyntax/ext/qquote.rs | 10 | ||||
| -rw-r--r-- | src/libsyntax/ext/simplext.rs | 2 | ||||
| -rw-r--r-- | src/libsyntax/ext/source_util.rs | 4 | ||||
| -rw-r--r-- | src/libsyntax/fold.rs | 12 | ||||
| -rw-r--r-- | src/libsyntax/parse/parser.rs | 10 | ||||
| -rw-r--r-- | src/libsyntax/print/pprust.rs | 8 | ||||
| -rw-r--r-- | src/libsyntax/visit.rs | 8 |
13 files changed, 67 insertions, 65 deletions
diff --git a/src/libsyntax/ast_map.rs b/src/libsyntax/ast_map.rs index 0733dc903ba..f393f37dfb9 100644 --- a/src/libsyntax/ast_map.rs +++ b/src/libsyntax/ast_map.rs @@ -11,7 +11,7 @@ type path = ~[path_elt]; /* FIXMEs that say "bad" are as per #2543 */ fn path_to_str_with_sep(p: path, sep: str) -> str { - let strs = vec::map(p) {|e| + let strs = do vec::map(p) {|e| alt e { path_mod(s) { /* FIXME (#2543) */ copy *s } path_name(s) { /* FIXME (#2543) */ copy *s } @@ -156,7 +156,7 @@ fn map_block(b: blk, cx: ctx, v: vt) { } fn number_pat(cx: ctx, pat: @pat) { - ast_util::walk_pat(pat) {|p| + do ast_util::walk_pat(pat) {|p| alt p.node { pat_ident(_, _) { cx.map.insert(p.id, node_local(cx.local_id)); @@ -218,12 +218,12 @@ fn map_item(i: @item, cx: ctx, v: vt) { let (_, ms) = ast_util::split_class_items(items); // Map iface refs to their parent classes. This is // so we can find the self_ty - vec::iter(ifces) {|p| cx.map.insert(p.id, + do vec::iter(ifces) {|p| cx.map.insert(p.id, node_item(i, item_path)); }; let d_id = ast_util::local_def(i.id); let p = extend(cx, i.ident); // only need to handle methods - vec::iter(ms) {|m| map_method(d_id, p, m, cx); } + do vec::iter(ms) {|m| map_method(d_id, p, m, cx); } } _ { } } diff --git a/src/libsyntax/ast_util.rs b/src/libsyntax/ast_util.rs index 8d0cca2770a..fdb6d4dc7d9 100644 --- a/src/libsyntax/ast_util.rs +++ b/src/libsyntax/ast_util.rs @@ -408,7 +408,7 @@ fn id_visitor(vfn: fn@(node_id)) -> visit::vt<()> { alt vi.node { view_item_use(_, _, id) { vfn(id) } view_item_import(vps) | view_item_export(vps) { - vec::iter(vps) {|vp| + do vec::iter(vps) {|vp| alt vp.node { view_path_simple(_, _, id) { vfn(id) } view_path_glob(_, id) { vfn(id) } @@ -473,7 +473,7 @@ fn id_visitor(vfn: fn@(node_id)) -> visit::vt<()> { }, visit_ty_params: fn@(ps: ~[ty_param]) { - vec::iter(ps) {|p| vfn(p.id) } + vec::iter(ps, {|p| vfn(p.id) }) }, visit_constr: fn@(_p: @path, _sp: span, id: node_id) { @@ -486,23 +486,23 @@ fn id_visitor(vfn: fn@(node_id)) -> visit::vt<()> { alt fk { visit::fk_ctor(nm, tps, self_id, parent_id) { - vec::iter(tps) {|tp| vfn(tp.id)} + vec::iter(tps, {|tp| vfn(tp.id)}); vfn(id); vfn(self_id); vfn(parent_id.node); } visit::fk_dtor(tps, self_id, parent_id) { - vec::iter(tps) {|tp| vfn(tp.id)} + vec::iter(tps, {|tp| vfn(tp.id)}); vfn(id); vfn(self_id); vfn(parent_id.node); } visit::fk_item_fn(_, tps) { - vec::iter(tps) {|tp| vfn(tp.id)} + vec::iter(tps, {|tp| vfn(tp.id)}); } visit::fk_method(_, tps, m) { vfn(m.self_id); - vec::iter(tps) {|tp| vfn(tp.id)} + vec::iter(tps, {|tp| vfn(tp.id)}); } visit::fk_anon(_, capture_clause) | visit::fk_fn_block(capture_clause) { @@ -512,7 +512,7 @@ fn id_visitor(vfn: fn@(node_id)) -> visit::vt<()> { } } - vec::iter(d.inputs) {|arg| + do vec::iter(d.inputs) {|arg| vfn(arg.id) } }, @@ -536,7 +536,7 @@ fn visit_ids_for_inlined_item(item: inlined_item, vfn: fn@(node_id)) { fn compute_id_range(visit_ids_fn: fn(fn@(node_id))) -> id_range { let min = @mut int::max_value; let max = @mut int::min_value; - visit_ids_fn { |id| + do visit_ids_fn { |id| *min = int::min(*min, id); *max = int::max(*max, id + 1); } @@ -544,7 +544,7 @@ fn compute_id_range(visit_ids_fn: fn(fn@(node_id))) -> id_range { } fn compute_id_range_for_inlined_item(item: inlined_item) -> id_range { - compute_id_range { |f| visit_ids_for_inlined_item(item, f) } + compute_id_range({ |f| visit_ids_for_inlined_item(item, f) }) } pure fn is_item_impl(item: @ast::item) -> bool { diff --git a/src/libsyntax/attr.rs b/src/libsyntax/attr.rs index e137dc6127c..08e2fd6c9b8 100644 --- a/src/libsyntax/attr.rs +++ b/src/libsyntax/attr.rs @@ -315,7 +315,7 @@ From a list of crate attributes get only the meta_items that impact crate linkage "] fn find_linkage_metas(attrs: ~[ast::attribute]) -> ~[@ast::meta_item] { - find_linkage_attrs(attrs).flat_map {|attr| + do find_linkage_attrs(attrs).flat_map {|attr| alt check attr.node.value.node { ast::meta_list(_, items) { /* FIXME (#2543) */ copy items } } @@ -351,7 +351,7 @@ enum inline_attr { #[doc = "True if something like #[inline] is found in the list of attrs."] fn find_inline_attr(attrs: ~[ast::attribute]) -> inline_attr { // TODO---validate the usage of #[inline] and #[inline(always)] - vec::foldl(ia_none, attrs) {|ia,attr| + do vec::foldl(ia_none, attrs) {|ia,attr| alt attr.node.value.node { ast::meta_word(@"inline") { ia_hint } ast::meta_list(@"inline", items) { diff --git a/src/libsyntax/diagnostic.rs b/src/libsyntax/diagnostic.rs index b8ebb27f51b..56017cd1f27 100644 --- a/src/libsyntax/diagnostic.rs +++ b/src/libsyntax/diagnostic.rs @@ -249,7 +249,7 @@ fn highlight_lines(cm: codemap::codemap, sp: span, } fn print_macro_backtrace(cm: codemap::codemap, sp: span) { - option::iter (sp.expn_info) {|ei| + do option::iter (sp.expn_info) {|ei| let ss = option::map_default(ei.callie.span, @"", { |span| @codemap::span_to_str(span, cm) diff --git a/src/libsyntax/ext/auto_serialize.rs b/src/libsyntax/ext/auto_serialize.rs index 0e4592b1970..487a435df46 100644 --- a/src/libsyntax/ext/auto_serialize.rs +++ b/src/libsyntax/ext/auto_serialize.rs @@ -100,7 +100,7 @@ fn expand(cx: ext_ctxt, with *item} } - vec::flat_map(in_items) {|in_item| + do vec::flat_map(in_items) {|in_item| alt in_item.node { ast::item_ty(ty, tps, _) { vec::append(~[filter_attrs(in_item)], @@ -151,7 +151,7 @@ impl helpers for ext_ctxt { fn ty_fn(span: span, -input_tys: ~[@ast::ty], -output: @ast::ty) -> @ast::ty { - let args = vec::map(input_tys) {|ty| + let args = do vec::map(input_tys) {|ty| {mode: ast::expl(ast::by_ref), ty: ty, ident: @"", @@ -294,7 +294,7 @@ fn ser_path(cx: ext_ctxt, tps: ser_tps_map, path: @ast::path, ast::expr_path( cx.helper_path(path, "serialize"))); - let ty_args = vec::map(path.types) {|ty| + let ty_args = do vec::map(path.types) {|ty| let sv_stmts = ser_ty(cx, tps, ty, cx.clone(s), #ast{ __v }); let sv = cx.expr(path.span, ast::expr_block(cx.blk(path.span, sv_stmts))); @@ -316,12 +316,14 @@ fn ser_variant(cx: ext_ctxt, bodyfn: fn(-@ast::expr, ast::blk) -> @ast::expr, argfn: fn(-@ast::expr, uint, ast::blk) -> @ast::expr) -> ast::arm { - let vnames = vec::from_fn(vec::len(tys)) {|i| @#fmt["__v%u", i]}; - let pats = vec::from_fn(vec::len(tys)) {|i| + let vnames = do vec::from_fn(vec::len(tys)) {|i| + @#fmt["__v%u", i] + }; + let pats = do vec::from_fn(vec::len(tys)) {|i| cx.binder_pat(tys[i].span, vnames[i]) }; let pat: @ast::pat = @{id: cx.next_id(), node: pfn(pats), span: span}; - let stmts = vec::from_fn(vec::len(tys)) {|i| + let stmts = do vec::from_fn(vec::len(tys)) {|i| let v = cx.var_ref(span, vnames[i]); let arg_blk = cx.blk( @@ -374,7 +376,7 @@ fn ser_ty(cx: ext_ctxt, tps: ser_tps_map, } ast::ty_rec(flds) { - let fld_stmts = vec::from_fn(vec::len(flds)) {|fidx| + let fld_stmts = do vec::from_fn(vec::len(flds)) {|fidx| let fld = flds[fidx]; let vf = cx.expr(fld.span, ast::expr_field(cx.clone(v), @@ -516,7 +518,7 @@ fn mk_ser_fn(cx: ext_ctxt, span: span, name: ast::ident, tp_inputs); let tps_map = map::str_hash(); - vec::iter2(tps, tp_inputs) {|tp, arg| + do vec::iter2(tps, tp_inputs) {|tp, arg| let arg_ident = arg.ident; tps_map.insert( *tp.ident, @@ -537,7 +539,7 @@ fn mk_ser_fn(cx: ext_ctxt, span: span, name: ast::ident, vec::append(~[{ident: @"__S", id: cx.next_id(), bounds: ser_bnds}], - vec::map(tps) {|tp| cx.clone_ty_param(tp) }); + vec::map(tps, {|tp| cx.clone_ty_param(tp) })); let ser_output: @ast::ty = @{id: cx.next_id(), node: ast::ty_nil, @@ -573,7 +575,7 @@ fn deser_path(cx: ext_ctxt, tps: deser_tps_map, path: @ast::path, ast::expr_path( cx.helper_path(path, "deserialize"))); - let ty_args = vec::map(path.types) {|ty| + let ty_args = do vec::map(path.types) {|ty| let dv_expr = deser_ty(cx, tps, ty, cx.clone(d)); cx.lambda(cx.expr_blk(dv_expr)) }; @@ -616,7 +618,7 @@ fn deser_ty(cx: ext_ctxt, tps: deser_tps_map, } ast::ty_rec(flds) { - let fields = vec::from_fn(vec::len(flds)) {|fidx| + let fields = do vec::from_fn(vec::len(flds)) {|fidx| let fld = flds[fidx]; let d = cx.clone(d); let f = cx.lit_str(fld.span, fld.node.ident); @@ -645,7 +647,7 @@ fn deser_ty(cx: ext_ctxt, tps: deser_tps_map, // d.read_tup_elt(2u, {||...})) // } - let arg_exprs = vec::from_fn(vec::len(tys)) {|i| + let arg_exprs = do vec::from_fn(vec::len(tys)) {|i| let idx = cx.lit_uint(ty.span, i); let body = deser_lambda(cx, tps, tys[i], cx.clone(d)); #ast{ $(d).read_tup_elt($(idx), $(body)) } @@ -723,7 +725,7 @@ fn mk_deser_fn(cx: ext_ctxt, span: span, tp_inputs); let tps_map = map::str_hash(); - vec::iter2(tps, tp_inputs) {|tp, arg| + do vec::iter2(tps, tp_inputs) {|tp, arg| let arg_ident = arg.ident; tps_map.insert( *tp.ident, @@ -743,12 +745,12 @@ fn mk_deser_fn(cx: ext_ctxt, span: span, vec::append(~[{ident: @"__D", id: cx.next_id(), bounds: deser_bnds}], - vec::map(tps) {|tp| + vec::map(tps, {|tp| let cloned = cx.clone_ty_param(tp); {bounds: @(vec::append(*cloned.bounds, ~[ast::bound_copy])) with cloned} - }); + })); let deser_blk = cx.expr_blk(f(cx, tps_map, #ast(expr){__d})); @@ -781,11 +783,11 @@ fn ser_enum(cx: ext_ctxt, tps: ser_tps_map, e_name: ast::ident, e_span: span, variants: ~[ast::variant], -s: @ast::expr, -v: @ast::expr) -> ~[@ast::stmt] { let ext_cx = cx; - let arms = vec::from_fn(vec::len(variants)) {|vidx| + let arms = do vec::from_fn(vec::len(variants)) {|vidx| let variant = variants[vidx]; let v_span = variant.span; let v_name = variant.node.name; - let variant_tys = vec::map(variant.node.args) {|a| a.ty }; + let variant_tys = vec::map(variant.node.args, {|a| a.ty }); ser_variant( cx, tps, variant_tys, v_span, cx.clone(s), @@ -830,13 +832,13 @@ fn deser_enum(cx: ext_ctxt, tps: deser_tps_map, e_name: ast::ident, e_span: span, variants: ~[ast::variant], -d: @ast::expr) -> @ast::expr { let ext_cx = cx; - let arms: ~[ast::arm] = vec::from_fn(vec::len(variants)) {|vidx| + let arms: ~[ast::arm] = do vec::from_fn(vec::len(variants)) {|vidx| let variant = variants[vidx]; let v_span = variant.span; let v_name = variant.node.name; - let tys = vec::map(variant.node.args) {|a| a.ty }; + let tys = vec::map(variant.node.args, {|a| a.ty }); - let arg_exprs = vec::from_fn(vec::len(tys)) {|i| + let arg_exprs = do vec::from_fn(vec::len(tys)) {|i| let idx = cx.lit_uint(v_span, i); let body = deser_lambda(cx, tps, tys[i], cx.clone(d)); #ast{ $(d).read_enum_variant_arg($(idx), $(body)) } diff --git a/src/libsyntax/ext/expand.rs b/src/libsyntax/ext/expand.rs index 77bf868de37..1b7abc21394 100644 --- a/src/libsyntax/ext/expand.rs +++ b/src/libsyntax/ext/expand.rs @@ -100,8 +100,8 @@ fn expand_mod_items(exts: hashmap<str, syntax_extension>, cx: ext_ctxt, // For each item, look through the attributes. If any of them are // decorated with "item decorators", then use that function to transform // the item into a new set of items. - let new_items = vec::flat_map(module.items) {|item| - vec::foldr(item.attrs, ~[item]) {|attr, items| + let new_items = do vec::flat_map(module.items) {|item| + do vec::foldr(item.attrs, ~[item]) {|attr, items| let mname = alt attr.node.value.node { ast::meta_word(n) { n } ast::meta_name_value(n, _) { n } diff --git a/src/libsyntax/ext/qquote.rs b/src/libsyntax/ext/qquote.rs index 17468e6b9ef..367a0dcea50 100644 --- a/src/libsyntax/ext/qquote.rs +++ b/src/libsyntax/ext/qquote.rs @@ -106,7 +106,7 @@ fn gather_anti_quotes<N: qq_helper>(lo: uint, node: N) -> aq_ctxt node.visit(cx, mk_vt(v)); // FIXME (#2250): Maybe this is an overkill (merge_sort), it might // be better to just keep the gather array in sorted order. - cx.gather.swap { |v| + do cx.gather.swap { |v| vec::to_mut(std::sort::merge_sort({|a,b| a.lo < b.lo}, v)) }; ret cx; @@ -132,7 +132,7 @@ fn expand_ast(ecx: ext_ctxt, _sp: span, -> @ast::expr { let mut what = "expr"; - option::iter(arg) {|arg| + do option::iter(arg) {|arg| let args: ~[@ast::expr] = alt arg.node { ast::expr_vec(elts, _) { elts } @@ -205,7 +205,7 @@ fn finish<T: qq_helper> let mut state = active; let mut i = 0u, j = 0u; let g_len = cx.gather.len(); - str::chars_iter(*str) {|ch| + do str::chars_iter(*str) {|ch| if (j < g_len && i == cx.gather[j].lo) { assert ch == '$'; let repl = #fmt("$%u ", j); @@ -259,11 +259,11 @@ fn finish<T: qq_helper> rcall = mk_call(cx,sp, ~[@"syntax", @"ext", @"qquote", @"replace"], ~[pcall, - mk_uniq_vec_e(cx,sp, qcx.gather.map_to_vec {|g| + mk_uniq_vec_e(cx,sp, qcx.gather.map_to_vec({|g| mk_call(cx,sp, ~[@"syntax", @"ext", @"qquote", @g.constr], - ~[g.e])}), + ~[g.e])})), mk_path(cx,sp, ~[@"syntax", @"ext", @"qquote", @node.get_fold_fn()])]); diff --git a/src/libsyntax/ext/simplext.rs b/src/libsyntax/ext/simplext.rs index bfd78b40b6f..cc3a4d04d06 100644 --- a/src/libsyntax/ext/simplext.rs +++ b/src/libsyntax/ext/simplext.rs @@ -276,7 +276,7 @@ fn transcribe_exprs(cx: ext_ctxt, b: bindings, idx_path: @mut ~[uint], let mut repeat: option<{rep_count: uint, name: ident}> = none; /* we need to walk over all the free vars in lockstep, except for the leaves, which are just duplicated */ - free_vars(b, repeat_me) {|fv| + do free_vars(b, repeat_me) {|fv| let cur_pos = follow(b.get(fv), idx_path); alt cur_pos { leaf(_) { } diff --git a/src/libsyntax/ext/source_util.rs b/src/libsyntax/ext/source_util.rs index d8afdb7534a..51feb53b2b3 100644 --- a/src/libsyntax/ext/source_util.rs +++ b/src/libsyntax/ext/source_util.rs @@ -88,9 +88,9 @@ fn expand_include_bin(cx: ext_ctxt, sp: codemap::span, arg: ast::mac_arg, alt io::read_whole_file(res_rel_file(cx, sp, file)) { result::ok(src) { - let u8_exprs = vec::map(src) { |char: u8| + let u8_exprs = vec::map(src, { |char: u8| mk_lit(cx, sp, ast::lit_uint(char as u64, ast::ty_u8)) - }; + }); ret mk_uniq_vec_e(cx, sp, u8_exprs); } result::err(e) { diff --git a/src/libsyntax/fold.rs b/src/libsyntax/fold.rs index 942441c5513..dbe09a31dd2 100644 --- a/src/libsyntax/fold.rs +++ b/src/libsyntax/fold.rs @@ -255,7 +255,7 @@ fn noop_fold_item_underscore(i: item_, fld: ast_fold) -> item_ { let ctor_body = fld.fold_block(ctor.node.body); let ctor_decl = fold_fn_decl(ctor.node.dec, fld); let ctor_id = fld.new_id(ctor.node.id); - let dtor = option::map(m_dtor) {|dtor| + let dtor = do option::map(m_dtor) {|dtor| let dtor_body = fld.fold_block(dtor.node.body); let dtor_id = fld.new_id(dtor.node.id); {node: {body: dtor_body, @@ -273,7 +273,7 @@ fn noop_fold_item_underscore(i: item_, fld: ast_fold) -> item_ { item_impl(tps, rp, ifce, ty, methods) { item_impl(fold_ty_params(tps, fld), rp, - ifce.map { |p| fold_iface_ref(p, fld) }, + ifce.map({ |p| fold_iface_ref(p, fld) }), fld.fold_ty(ty), vec::map(methods, fld.fold_method)) } @@ -332,8 +332,8 @@ fn noop_fold_pat(p: pat_, fld: ast_fold) -> pat_ { } pat_lit(e) { pat_lit(fld.fold_expr(e)) } pat_enum(pth, pats) { - pat_enum(fld.fold_path(pth), option::map(pats) - {|pats| vec::map(pats, fld.fold_pat)}) + pat_enum(fld.fold_path(pth), option::map(pats, + {|pats| vec::map(pats, fld.fold_pat)})) } pat_rec(fields, etc) { let mut fs = ~[]; @@ -490,9 +490,9 @@ fn noop_fold_ty(t: ty_, fld: ast_fold) -> ty_ { ty_vec(mt) {ty_vec(fold_mt(mt, fld))} ty_ptr(mt) {ty_ptr(fold_mt(mt, fld))} ty_rptr(region, mt) {ty_rptr(region, fold_mt(mt, fld))} - ty_rec(fields) {ty_rec(vec::map(fields) {|f| fold_field(f, fld)})} + ty_rec(fields) {ty_rec(vec::map(fields, {|f| fold_field(f, fld)}))} ty_fn(proto, decl) {ty_fn(proto, fold_fn_decl(decl, fld))} - ty_tup(tys) {ty_tup(vec::map(tys) {|ty| fld.fold_ty(ty)})} + ty_tup(tys) {ty_tup(vec::map(tys, {|ty| fld.fold_ty(ty)}))} ty_path(path, id) {ty_path(fld.fold_path(path), fld.new_id(id))} ty_constr(ty, constrs) {ty_constr(fld.fold_ty(ty), vec::map(constrs, fld.fold_ty_constr))} diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index c9406731030..da09b5daf27 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -159,7 +159,7 @@ class parser { } fn parse_ty_fn_decl(purity: ast::purity) -> fn_decl { - let inputs = self.parse_unspanned_seq( + let inputs = do self.parse_unspanned_seq( token::LPAREN, token::RPAREN, seq_sep_trailing_disallowed(token::COMMA)) { |p| let mode = p.parse_arg_mode(); @@ -186,7 +186,7 @@ class parser { } fn parse_ty_methods() -> ~[ty_method] { - self.parse_unspanned_seq(token::LBRACE, token::RBRACE, + do self.parse_unspanned_seq(token::LBRACE, token::RBRACE, seq_sep_none()) { |p| let attrs = p.parse_outer_attributes(); let flo = p.span.lo; @@ -494,11 +494,11 @@ class parser { } fn parse_arg_or_capture_item() -> arg_or_capture_item { - self.parse_capture_item_or() {|p| p.parse_arg() } + self.parse_capture_item_or({|p| p.parse_arg() }) } fn parse_fn_block_arg() -> arg_or_capture_item { - self.parse_capture_item_or() {|p| + do self.parse_capture_item_or {|p| let m = p.parse_arg_mode(); let i = p.parse_value_ident(); let t = if p.eat(token::COLON) { @@ -2065,7 +2065,7 @@ class parser { members(mms) { ms = vec::append(ms, mms); } } } - let actual_dtor = option::map(the_dtor) {|dtor| + let actual_dtor = do option::map(the_dtor) {|dtor| let (d_body, d_s) = dtor; {node: {id: self.get_id(), self_id: self.get_id(), diff --git a/src/libsyntax/print/pprust.rs b/src/libsyntax/print/pprust.rs index 53d32f2f32f..9a994afb149 100644 --- a/src/libsyntax/print/pprust.rs +++ b/src/libsyntax/print/pprust.rs @@ -511,7 +511,7 @@ fn print_item(s: ps, &&item: @ast::item) { print_fn_args_and_ret(s, ctor.node.dec, ~[]); space(s.s); print_block(s, ctor.node.body); - option::iter(m_dtor) {|dtor| + do option::iter(m_dtor) {|dtor| hardbreak_if_not_bol(s); maybe_print_comment(s, dtor.span.lo); head(s, "drop"); @@ -1136,8 +1136,8 @@ fn print_decl(s: ps, decl: @ast::decl) { word_nbsp(s, "let"); // if any are mut, all are mut - if vec::any(locs) {|l| l.node.is_mutbl } { - assert vec::all(locs) {|l| l.node.is_mutbl }; + if vec::any(locs, {|l| l.node.is_mutbl }) { + assert vec::all(locs, {|l| l.node.is_mutbl }); word_nbsp(s, "mut"); } @@ -1405,7 +1405,7 @@ fn print_view_path(s: ps, &&vp: @ast::view_path) { ast::view_path_list(path, idents, _) { print_path(s, path, false); word(s.s, "::{"); - commasep(s, inconsistent, idents) {|s, w| + do commasep(s, inconsistent, idents) {|s, w| word(s.s, *w.node.name) } word(s.s, "}"); diff --git a/src/libsyntax/visit.rs b/src/libsyntax/visit.rs index 1e96899fa5c..4e8f1028bcd 100644 --- a/src/libsyntax/visit.rs +++ b/src/libsyntax/visit.rs @@ -151,7 +151,7 @@ fn visit_item<E>(i: @item, e: E, v: vt<E>) { for ifaces.each {|p| visit_path(p.path, e, v); } visit_class_ctor_helper(ctor, i.ident, tps, ast_util::local_def(i.id), e, v); - option::iter(m_dtor) {|dtor| + do option::iter(m_dtor) {|dtor| visit_class_dtor_helper(dtor, tps, ast_util::local_def(i.id), e, v)}; } @@ -227,7 +227,7 @@ fn visit_pat<E>(p: @pat, e: E, v: vt<E>) { alt p.node { pat_enum(path, children) { visit_path(path, e, v); - option::iter(children) {|children| + do option::iter(children) {|children| for children.each {|child| v.visit_pat(child, e, v); }} } pat_rec(fields, _) { @@ -239,7 +239,7 @@ fn visit_pat<E>(p: @pat, e: E, v: vt<E>) { } pat_ident(path, inner) { visit_path(path, e, v); - option::iter(inner) {|subpat| v.visit_pat(subpat, e, v)}; + do option::iter(inner) {|subpat| v.visit_pat(subpat, e, v)}; } pat_lit(ex) { v.visit_expr(ex, e, v); } pat_range(e1, e2) { v.visit_expr(e1, e, v); v.visit_expr(e2, e, v); } @@ -344,7 +344,7 @@ fn visit_exprs<E>(exprs: ~[@expr], e: E, v: vt<E>) { fn visit_mac<E>(m: mac, e: E, v: vt<E>) { alt m.node { ast::mac_invoc(pth, arg, body) { - option::map(arg) {|arg| v.visit_expr(arg, e, v)}; } + option::map(arg, {|arg| v.visit_expr(arg, e, v)}); } ast::mac_invoc_tt(pth, tt) { /* no user-serviceable parts inside */ } ast::mac_embed_type(ty) { v.visit_ty(ty, e, v); } ast::mac_embed_block(blk) { v.visit_block(blk, e, v); } |
