diff --git a/src/compiletest/compiletest.rs b/src/compiletest/compiletest.rs index 8d48669ab17..264ee61018b 100644 --- a/src/compiletest/compiletest.rs +++ b/src/compiletest/compiletest.rs @@ -58,7 +58,7 @@ fn parse_config(args: ~[~str]) -> config { } else { option::None }, logfile: option::map(&getopts::opt_maybe_str(matches, ~"logfile"), - |s| Path(s)), + |s| Path(*s)), runtool: getopts::opt_maybe_str(matches, ~"runtool"), rustcflags: getopts::opt_maybe_str(matches, ~"rustcflags"), jit: getopts::opt_present(matches, ~"jit"), diff --git a/src/compiletest/header.rs b/src/compiletest/header.rs index 19a3c621d27..d72a9d65e05 100644 --- a/src/compiletest/header.rs +++ b/src/compiletest/header.rs @@ -103,7 +103,7 @@ fn parse_compile_flags(line: ~str) -> Option<~str> { fn parse_exec_env(line: ~str) -> Option<(~str, ~str)> { do parse_name_value_directive(line, ~"exec-env").map |nv| { // nv is either FOO or FOO=BAR - let strs = str::splitn_char(nv, '=', 1u); + let strs = str::splitn_char(*nv, '=', 1u); match strs.len() { 1u => (strs[0], ~""), 2u => (strs[0], strs[1]), diff --git a/src/libcore/dlist.rs b/src/libcore/dlist.rs index d50abc64f2b..fcf8146200d 100644 --- a/src/libcore/dlist.rs +++ b/src/libcore/dlist.rs @@ -275,13 +275,13 @@ impl DList { /// Remove a node from the head of the list. O(1). fn pop_n() -> Option> { let hd = self.peek_n(); - hd.map(|nobe| self.unlink(nobe)); + hd.map(|nobe| self.unlink(*nobe)); hd } /// Remove a node from the tail of the list. O(1). fn pop_tail_n() -> Option> { let tl = self.peek_tail_n(); - tl.map(|nobe| self.unlink(nobe)); + tl.map(|nobe| self.unlink(*nobe)); tl } /// Get the node at the list's head. O(1). diff --git a/src/libcore/iter.rs b/src/libcore/iter.rs index 00091d0ed41..bc1955698fc 100644 --- a/src/libcore/iter.rs +++ b/src/libcore/iter.rs @@ -290,7 +290,7 @@ pure fn from_elem>(n_elts: uint, t: T) -> BT { pure fn append,BT: Buildable>( lhs: IT, rhs: IT) -> BT { let size_opt = lhs.size_hint().chain( - |sz1| rhs.size_hint().map(|sz2| sz1+sz2)); + |sz1| rhs.size_hint().map(|sz2| sz1+*sz2)); do build_sized_opt(size_opt) |push| { for lhs.each |x| { push(*x); } for rhs.each |x| { push(*x); } diff --git a/src/libcore/option.rs b/src/libcore/option.rs index 518775ec751..ae28c6db083 100644 --- a/src/libcore/option.rs +++ b/src/libcore/option.rs @@ -61,13 +61,7 @@ pure fn expect(opt: &Option, +reason: ~str) -> T { match *opt { Some(x) => x, None => fail reason } } -pure fn map(opt: &Option, f: fn(T) -> U) -> Option { - //! Maps a `some` value from one type to another - - match *opt { Some(x) => Some(f(x)), None => None } -} - -pure fn map_ref(opt: &Option, f: fn(x: &T) -> U) -> Option { +pure fn map(opt: &Option, f: fn(x: &T) -> U) -> Option { //! Maps a `some` value by reference from one type to another match *opt { Some(ref x) => Some(f(x)), None => None } @@ -138,14 +132,7 @@ pure fn get_default(opt: &Option, +def: T) -> T { match *opt { Some(x) => x, None => def } } -pure fn map_default(opt: &Option, +def: U, f: fn(T) -> U) -> U { - //! Applies a function to the contained value or returns a default - - match *opt { None => move def, Some(t) => f(t) } -} - -// This should replace map_default. -pure fn map_default_ref(opt: &Option, +def: U, +pure fn map_default(opt: &Option, +def: U, f: fn(x: &T) -> U) -> U { //! Applies a function to the contained value or returns a default @@ -200,17 +187,12 @@ impl Option { * function that returns an option. */ pure fn chain(f: fn(T) -> Option) -> Option { chain(&self, f) } - /// Applies a function to the contained value or returns a default - pure fn map_default(+def: U, f: fn(T) -> U) -> U - { map_default(&self, move def, f) } /// Performs an operation on the contained value or does nothing pure fn iter(f: fn(T)) { iter(&self, f) } /// Returns true if the option equals `none` pure fn is_none() -> bool { is_none(&self) } /// Returns true if the option contains some value pure fn is_some() -> bool { is_some(&self) } - /// Maps a `some` value from one type to another - pure fn map(f: fn(T) -> U) -> Option { map(&self, f) } } impl &Option { @@ -222,12 +204,12 @@ impl &Option { chain_ref(self, f) } /// Applies a function to the contained value or returns a default - pure fn map_default_ref(+def: U, f: fn(x: &T) -> U) -> U - { map_default_ref(self, move def, f) } + pure fn map_default(+def: U, f: fn(x: &T) -> U) -> U + { map_default(self, move def, f) } /// Performs an operation on the contained value by reference pure fn iter_ref(f: fn(x: &T)) { iter_ref(self, f) } /// Maps a `some` value from one type to another by reference - pure fn map_ref(f: fn(x: &T) -> U) -> Option { map_ref(self, f) } + pure fn map(f: fn(x: &T) -> U) -> Option { map(self, f) } /// Gets an immutable reference to the value inside a `some`. pure fn get_ref() -> &self/T { get_ref(self) } } diff --git a/src/libcore/os.rs b/src/libcore/os.rs index 0a2f00e3f2b..7803783ea66 100644 --- a/src/libcore/os.rs +++ b/src/libcore/os.rs @@ -439,7 +439,7 @@ fn self_exe_path() -> Option { } do load_self().map |pth| { - Path(pth).dir_path() + Path(*pth).dir_path() } } diff --git a/src/libcore/task/local_data_priv.rs b/src/libcore/task/local_data_priv.rs index 2fbb88327ed..31369c47c64 100644 --- a/src/libcore/task/local_data_priv.rs +++ b/src/libcore/task/local_data_priv.rs @@ -75,8 +75,8 @@ unsafe fn local_data_lookup( ); do map_pos.map |index| { // .get() is guaranteed because of "None { false }" above. - let (_, data_ptr, _) = (*map)[index].get(); - (index, data_ptr) + let (_, data_ptr, _) = (*map)[*index].get(); + (*index, data_ptr) } } @@ -91,7 +91,7 @@ unsafe fn local_get_helper( // was referenced in the local_data box, though, not here, so before // overwriting the local_data_box we need to give an extra reference. // We must also give an extra reference when not removing. - let (index, data_ptr) = result; + let (index, data_ptr) = *result; let data: @T = cast::transmute(move data_ptr); cast::bump_box_refcount(data); if do_pop { diff --git a/src/libcore/task/spawn.rs b/src/libcore/task/spawn.rs index 21f217d57f4..f2568414392 100644 --- a/src/libcore/task/spawn.rs +++ b/src/libcore/task/spawn.rs @@ -200,7 +200,7 @@ fn each_ancestor(list: &mut AncestorList, // the end of the list, which doesn't make sense to coalesce. return do (**ancestors).map_default((None,false)) |ancestor_arc| { // NB: Takes a lock! (this ancestor node) - do access_ancestors(&ancestor_arc) |nobe| { + do access_ancestors(ancestor_arc) |nobe| { // Check monotonicity assert last_generation > nobe.generation; /*##########################################################* diff --git a/src/libcore/vec.rs b/src/libcore/vec.rs index 50011dbacec..a0516116bdf 100644 --- a/src/libcore/vec.rs +++ b/src/libcore/vec.rs @@ -969,7 +969,7 @@ pure fn find(v: &[T], f: fn(T) -> bool) -> Option { */ pure fn find_between(v: &[T], start: uint, end: uint, f: fn(T) -> bool) -> Option { - position_between(v, start, end, f).map(|i| v[i]) + position_between(v, start, end, f).map(|i| v[*i]) } /** @@ -992,7 +992,7 @@ pure fn rfind(v: &[T], f: fn(T) -> bool) -> Option { */ pure fn rfind_between(v: &[T], start: uint, end: uint, f: fn(T) -> bool) -> Option { - rposition_between(v, start, end, f).map(|i| v[i]) + rposition_between(v, start, end, f).map(|i| v[*i]) } /// Find the first index containing a matching value diff --git a/src/libsyntax/diagnostic.rs b/src/libsyntax/diagnostic.rs index ca9db6d25ad..1c12397568d 100644 --- a/src/libsyntax/diagnostic.rs +++ b/src/libsyntax/diagnostic.rs @@ -262,7 +262,7 @@ fn highlight_lines(cm: codemap::codemap, sp: span, fn print_macro_backtrace(cm: codemap::codemap, sp: span) { do option::iter(&sp.expn_info) |ei| { let ss = option::map_default(&ei.callie.span, @~"", - |span| @codemap::span_to_str(span, cm)); + |span| @codemap::span_to_str(*span, cm)); print_diagnostic(*ss, note, fmt!("in expansion of #%s", ei.callie.name)); let ss = codemap::span_to_str(ei.call_site, cm); diff --git a/src/libsyntax/fold.rs b/src/libsyntax/fold.rs index 12c8dc2f7bb..3d9234df41e 100644 --- a/src/libsyntax/fold.rs +++ b/src/libsyntax/fold.rs @@ -114,7 +114,7 @@ fn fold_mac_(m: mac, fld: ast_fold) -> mac { match m.node { mac_invoc(pth, arg, body) => { mac_invoc(fld.fold_path(pth), - option::map(&arg, |x| fld.fold_expr(x)), body) + option::map(&arg, |x| fld.fold_expr(*x)), body) } mac_invoc_tt(*) => m.node, mac_ellipsis => mac_ellipsis, @@ -243,7 +243,7 @@ fn noop_fold_item_underscore(i: item_, fld: ast_fold) -> item_ { variants: vec::map(enum_definition.variants, |x| fld.fold_variant(*x)), common: option::map(&enum_definition.common, - |x| fold_struct_def(x, fld)) + |x| fold_struct_def(*x, fld)) }), fold_ty_params(typms, fld)) } item_class(struct_def, typms) => { @@ -252,7 +252,7 @@ fn noop_fold_item_underscore(i: item_, fld: ast_fold) -> item_ { } item_impl(tps, ifce, ty, methods) => { item_impl(fold_ty_params(tps, fld), - ifce.map(|p| fold_trait_ref(p, fld)), + ifce.map(|p| fold_trait_ref(*p, fld)), fld.fold_ty(ty), vec::map(methods, |x| fld.fold_method(*x))) } @@ -292,7 +292,7 @@ fn fold_struct_def(struct_def: @ast::struct_def, fld: ast_fold) let dtor_id = fld.new_id(dtor.node.id); {node: {body: dtor_body, id: dtor_id,.. dtor.node}, - .. dtor}}; + .. *dtor}}; return @{ traits: vec::map(struct_def.traits, |p| fold_trait_ref(*p, fld)), fields: vec::map(struct_def.fields, |f| fold_struct_field(*f, fld)), @@ -332,7 +332,7 @@ fn noop_fold_method(&&m: @method, fld: ast_fold) -> @method { fn noop_fold_block(b: blk_, fld: ast_fold) -> blk_ { return {view_items: vec::map(b.view_items, |x| fld.fold_view_item(*x)), stmts: vec::map(b.stmts, |x| fld.fold_stmt(*x)), - expr: option::map(&b.expr, |x| fld.fold_expr(x)), + expr: option::map(&b.expr, |x| fld.fold_expr(*x)), id: fld.new_id(b.id), rules: b.rules}; } @@ -347,7 +347,7 @@ fn noop_fold_stmt(s: stmt_, fld: ast_fold) -> stmt_ { fn noop_fold_arm(a: arm, fld: ast_fold) -> arm { return {pats: vec::map(a.pats, |x| fld.fold_pat(*x)), - guard: option::map(&a.guard, |x| fld.fold_expr(x)), + guard: option::map(&a.guard, |x| fld.fold_expr(*x)), body: fld.fold_block(a.body)}; } @@ -357,12 +357,12 @@ fn noop_fold_pat(p: pat_, fld: ast_fold) -> pat_ { pat_ident(binding_mode, pth, sub) => { pat_ident(binding_mode, fld.fold_path(pth), - option::map(&sub, |x| fld.fold_pat(x))) + option::map(&sub, |x| fld.fold_pat(*x))) } 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, |x| fld.fold_pat(*x)))) + |pats| vec::map(*pats, |x| fld.fold_pat(*x)))) } pat_rec(fields, etc) => { let mut fs = ~[]; @@ -432,7 +432,7 @@ fn noop_fold_expr(e: expr_, fld: ast_fold) -> expr_ { expr_repeat(fld.fold_expr(expr), fld.fold_expr(count), mutt), expr_rec(fields, maybe_expr) => { expr_rec(vec::map(fields, |x| fold_field(*x)), - option::map(&maybe_expr, |x| fld.fold_expr(x))) + option::map(&maybe_expr, |x| fld.fold_expr(*x))) } expr_tup(elts) => expr_tup(vec::map(elts, |x| fld.fold_expr(*x))), expr_call(f, args, blk) => { @@ -451,14 +451,14 @@ fn noop_fold_expr(e: expr_, fld: ast_fold) -> expr_ { expr_addr_of(m, ohs) => expr_addr_of(m, fld.fold_expr(ohs)), expr_if(cond, tr, fl) => { expr_if(fld.fold_expr(cond), fld.fold_block(tr), - option::map(&fl, |x| fld.fold_expr(x))) + option::map(&fl, |x| fld.fold_expr(*x))) } expr_while(cond, body) => { expr_while(fld.fold_expr(cond), fld.fold_block(body)) } expr_loop(body, opt_ident) => { expr_loop(fld.fold_block(body), - option::map(&opt_ident, |x| fld.fold_ident(x))) + option::map(&opt_ident, |x| fld.fold_ident(*x))) } expr_match(expr, arms) => { expr_match(fld.fold_expr(expr), @@ -500,12 +500,12 @@ fn noop_fold_expr(e: expr_, fld: ast_fold) -> expr_ { expr_index(fld.fold_expr(el), fld.fold_expr(er)) } expr_path(pth) => expr_path(fld.fold_path(pth)), - expr_fail(e) => expr_fail(option::map(&e, |x| fld.fold_expr(x))), + expr_fail(e) => expr_fail(option::map(&e, |x| fld.fold_expr(*x))), expr_break(opt_ident) => - expr_break(option::map(&opt_ident, |x| fld.fold_ident(x))), + expr_break(option::map(&opt_ident, |x| fld.fold_ident(*x))), expr_again(opt_ident) => - expr_again(option::map(&opt_ident, |x| fld.fold_ident(x))), - expr_ret(e) => expr_ret(option::map(&e, |x| fld.fold_expr(x))), + expr_again(option::map(&opt_ident, |x| fld.fold_ident(*x))), + expr_ret(e) => expr_ret(option::map(&e, |x| fld.fold_expr(*x))), expr_log(i, lv, e) => expr_log(i, fld.fold_expr(lv), fld.fold_expr(e)), expr_assert(e) => expr_assert(fld.fold_expr(e)), @@ -513,7 +513,7 @@ fn noop_fold_expr(e: expr_, fld: ast_fold) -> expr_ { expr_struct(path, fields, maybe_expr) => { expr_struct(fld.fold_path(path), vec::map(fields, |x| fold_field(*x)), - option::map(&maybe_expr, |x| fld.fold_expr(x))) + option::map(&maybe_expr, |x| fld.fold_expr(*x))) } } } @@ -577,7 +577,7 @@ fn noop_fold_variant(v: variant_, fld: ast_fold) -> variant_ { let dtor_id = fld.new_id(dtor.node.id); {node: {body: dtor_body, id: dtor_id,.. dtor.node}, - .. dtor}}; + .. *dtor}}; kind = struct_variant_kind(@{ traits: ~[], fields: vec::map(struct_def.fields, @@ -593,7 +593,7 @@ fn noop_fold_variant(v: variant_, fld: ast_fold) -> variant_ { let variants = vec::map(enum_definition.variants, |x| fld.fold_variant(*x)); let common = option::map(&enum_definition.common, - |x| fold_struct_def(x, fld)); + |x| fold_struct_def(*x, fld)); kind = enum_variant_kind(ast::enum_def({ variants: variants, common: common })); } diff --git a/src/libsyntax/parse.rs b/src/libsyntax/parse.rs index 751b3ce62b9..2c04b2a1419 100644 --- a/src/libsyntax/parse.rs +++ b/src/libsyntax/parse.rs @@ -73,7 +73,7 @@ fn parse_crate_from_crate_file(input: &Path, cfg: ast::crate_cfg, sess.chpos = rdr.chpos; sess.byte_pos = sess.byte_pos + rdr.pos; let cx = @{sess: sess, cfg: /* FIXME (#2543) */ copy p.cfg}; - let companionmod = input.filestem().map(|s| Path(s)); + let companionmod = input.filestem().map(|s| Path(*s)); let (m, attrs) = eval::eval_crate_directives_to_mod( cx, cdirs, &prefix, &companionmod); let mut hi = p.span.hi; diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index b650a8890c5..f8ad6c541f6 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -2758,7 +2758,7 @@ impl parser { } let actual_dtor = do the_dtor.map |dtor| { - let (d_body, d_attrs, d_s) = dtor; + let (d_body, d_attrs, d_s) = *dtor; {node: {id: self.get_id(), attrs: d_attrs, self_id: self.get_id(), @@ -3126,7 +3126,7 @@ impl parser { } self.bump(); let mut actual_dtor = do the_dtor.map |dtor| { - let (d_body, d_attrs, d_s) = dtor; + let (d_body, d_attrs, d_s) = *dtor; {node: {id: self.get_id(), attrs: d_attrs, self_id: self.get_id(), diff --git a/src/libsyntax/visit.rs b/src/libsyntax/visit.rs index de9caf48b63..93ef9508610 100644 --- a/src/libsyntax/visit.rs +++ b/src/libsyntax/visit.rs @@ -395,7 +395,7 @@ fn visit_exprs(exprs: ~[@expr], e: E, v: vt) { fn visit_mac(m: mac, e: E, v: vt) { match m.node { ast::mac_invoc(_, arg, _) => { - option::map(&arg, |arg| v.visit_expr(arg, e, v)); } + option::map(&arg, |arg| v.visit_expr(*arg, e, v)); } ast::mac_invoc_tt(*) => { /* no user-serviceable parts inside */ } ast::mac_ellipsis => (), ast::mac_aq(*) => { /* FIXME: maybe visit (Issue #2340) */ } diff --git a/src/rustc/driver/driver.rs b/src/rustc/driver/driver.rs index 3acacd3c0a5..e389f3a4bdf 100644 --- a/src/rustc/driver/driver.rs +++ b/src/rustc/driver/driver.rs @@ -507,7 +507,7 @@ fn build_session_options(binary: ~str, let extra_debuginfo = opt_present(matches, ~"xg"); let debuginfo = opt_present(matches, ~"g") || extra_debuginfo; let sysroot_opt = getopts::opt_maybe_str(matches, ~"sysroot"); - let sysroot_opt = sysroot_opt.map(|m| Path(m)); + let sysroot_opt = sysroot_opt.map(|m| Path(*m)); let target_opt = getopts::opt_maybe_str(matches, ~"target"); let save_temps = getopts::opt_present(matches, ~"save-temps"); match output_type { diff --git a/src/rustc/driver/rustc.rs b/src/rustc/driver/rustc.rs index 6ea5bb28023..38ce7a4fbac 100644 --- a/src/rustc/driver/rustc.rs +++ b/src/rustc/driver/rustc.rs @@ -172,14 +172,14 @@ fn run_compiler(args: ~[~str], demitter: diagnostic::emitter) { let sopts = build_session_options(binary, matches, demitter); let sess = build_session(sopts, demitter); let odir = getopts::opt_maybe_str(matches, ~"out-dir"); - let odir = odir.map(|o| Path(o)); + let odir = odir.map(|o| Path(*o)); let ofile = getopts::opt_maybe_str(matches, ~"o"); - let ofile = ofile.map(|o| Path(o)); + let ofile = ofile.map(|o| Path(*o)); let cfg = build_configuration(sess, binary, input); let pretty = option::map(&getopts::opt_default(matches, ~"pretty", ~"normal"), - |a| parse_pretty(sess, a) ); + |a| parse_pretty(sess, *a) ); match pretty { Some::(ppm) => { pretty_print_input(sess, cfg, input, ppm); diff --git a/src/rustc/front/config.rs b/src/rustc/front/config.rs index 4c262e3dc65..7e0d9ec2e86 100644 --- a/src/rustc/front/config.rs +++ b/src/rustc/front/config.rs @@ -104,7 +104,7 @@ fn fold_block(cx: ctxt, b: ast::blk_, fld: fold::ast_fold) -> let filtered_stmts = vec::filter_map(b.stmts, filter); return {view_items: b.view_items, stmts: vec::map(filtered_stmts, |x| fld.fold_stmt(*x)), - expr: option::map(&b.expr, |x| fld.fold_expr(x)), + expr: option::map(&b.expr, |x| fld.fold_expr(*x)), id: b.id, rules: b.rules}; } diff --git a/src/rustc/metadata/cstore.rs b/src/rustc/metadata/cstore.rs index edf6a9612c7..49e79e009da 100644 --- a/src/rustc/metadata/cstore.rs +++ b/src/rustc/metadata/cstore.rs @@ -177,7 +177,7 @@ fn get_dep_hashes(cstore: cstore) -> ~[~str] { fn get_path(cstore: cstore, d: ast::def_id) -> ~[~str] { option::map_default(&p(cstore).mod_path_map.find(d), ~[], - |ds| str::split_str(*ds, ~"::")) + |ds| str::split_str(**ds, ~"::")) } // Local Variables: // mode: rust diff --git a/src/rustc/metadata/decoder.rs b/src/rustc/metadata/decoder.rs index a6bb681bc16..bebf8344c08 100644 --- a/src/rustc/metadata/decoder.rs +++ b/src/rustc/metadata/decoder.rs @@ -196,7 +196,7 @@ fn field_mutability(d: ebml::Doc) -> ast::class_mutability { &ebml::maybe_get_doc(d, tag_class_mut), ast::class_immutable, |d| { - match ebml::doc_as_u8(d) as char { + match ebml::doc_as_u8(*d) as char { 'm' => ast::class_mutable, _ => ast::class_immutable } @@ -246,7 +246,7 @@ fn item_ty_param_bounds(item: ebml::Doc, tcx: ty::ctxt, cdata: cmd) fn item_ty_region_param(item: ebml::Doc) -> Option { ebml::maybe_get_doc(item, tag_region_param).map(|doc| { - let d = ebml::ebml_deserializer(doc); + let d = ebml::ebml_deserializer(*doc); ty::deserialize_region_variance(d) }) } diff --git a/src/rustc/middle/borrowck/check_loans.rs b/src/rustc/middle/borrowck/check_loans.rs index cedab91b04e..841d54c6b0d 100644 --- a/src/rustc/middle/borrowck/check_loans.rs +++ b/src/rustc/middle/borrowck/check_loans.rs @@ -183,7 +183,7 @@ impl check_loan_ctxt { debug!("check_pure_callee_or_arg(pc=%?, expr=%?, \ callee_id=%d, ty=%s)", pc, - opt_expr.map(|e| pprust::expr_to_str(e, tcx.sess.intr()) ), + opt_expr.map(|e| pprust::expr_to_str(*e, tcx.sess.intr()) ), callee_id, ty_to_str(self.tcx(), ty::node_id_to_type(tcx, callee_id))); diff --git a/src/rustc/middle/liveness.rs b/src/rustc/middle/liveness.rs index b39b7914905..ce998378fe5 100644 --- a/src/rustc/middle/liveness.rs +++ b/src/rustc/middle/liveness.rs @@ -659,7 +659,7 @@ impl Liveness { expr_path(_) => { let def = self.tcx.def_map.get(expr.id); relevant_def(def).map( - |rdef| self.variable_from_rdef(rdef, expr.span) + |rdef| self.variable_from_rdef(*rdef, expr.span) ) } _ => None @@ -675,7 +675,7 @@ impl Liveness { match self.tcx.def_map.find(node_id) { Some(def) => { relevant_def(def).map( - |rdef| self.variable_from_rdef(rdef, span) + |rdef| self.variable_from_rdef(*rdef, span) ) } None => { @@ -1396,7 +1396,7 @@ impl Liveness { // Note: the field_map is empty unless we are in a ctor return self.ir.field_map.find(fld).map(|var| { let ln = self.live_node(expr.id, expr.span); - (ln, var) + (ln, *var) }); } _ => return None diff --git a/src/rustc/middle/mem_categorization.rs b/src/rustc/middle/mem_categorization.rs index 03d453a84f5..a9f4c195765 100644 --- a/src/rustc/middle/mem_categorization.rs +++ b/src/rustc/middle/mem_categorization.rs @@ -612,7 +612,7 @@ impl &mem_categorization_ctxt { cmt: cmt) -> cmt { @{id: arg.id(), span: arg.span(), cat: cat_comp(cmt, comp_variant(enum_did)), - lp: cmt.lp.map(|l| @lp_comp(l, comp_variant(enum_did)) ), + lp: cmt.lp.map(|l| @lp_comp(*l, comp_variant(enum_did)) ), mutbl: cmt.mutbl, // imm iff in an immutable context ty: self.tcx.ty(arg)} } @@ -649,7 +649,7 @@ impl &mem_categorization_ctxt { }; let m = self.inherited_mutability(base_cmt.mutbl, f_mutbl); let f_comp = comp_field(f_name, f_mutbl); - let lp = base_cmt.lp.map(|lp| @lp_comp(lp, f_comp) ); + let lp = base_cmt.lp.map(|lp| @lp_comp(*lp, f_comp) ); @{id: node.id(), span: node.span(), cat: cat_comp(base_cmt, f_comp), lp:lp, mutbl: m, ty: self.tcx.ty(node)} @@ -699,7 +699,7 @@ impl &mem_categorization_ctxt { } deref_comp(comp) => { - let lp = base_cmt.lp.map(|l| @lp_comp(l, comp) ); + let lp = base_cmt.lp.map(|l| @lp_comp(*l, comp) ); let m = self.inherited_mutability(base_cmt.mutbl, mt.mutbl); @{id:node.id(), span:node.span(), cat:cat_comp(base_cmt, comp), lp:lp, @@ -724,7 +724,7 @@ impl &mem_categorization_ctxt { // (a) the contents are loanable if the base is loanable // and this is a *unique* vector let deref_lp = match ptr { - uniq_ptr => {base_cmt.lp.map(|lp| @lp_deref(lp, uniq_ptr))} + uniq_ptr => {base_cmt.lp.map(|lp| @lp_deref(*lp, uniq_ptr))} _ => {None} }; @@ -756,7 +756,7 @@ impl &mem_categorization_ctxt { fn comp(expr: @ast::expr, of_cmt: cmt, vect: ty::t, mutbl: ast::mutability, ty: ty::t) -> cmt { let comp = comp_index(vect, mutbl); - let index_lp = of_cmt.lp.map(|lp| @lp_comp(lp, comp) ); + let index_lp = of_cmt.lp.map(|lp| @lp_comp(*lp, comp) ); @{id:expr.id, span:expr.span, cat:cat_comp(of_cmt, comp), lp:index_lp, mutbl:mutbl, ty:ty} @@ -766,7 +766,7 @@ impl &mem_categorization_ctxt { fn cat_tuple_elt(elt: N, cmt: cmt) -> cmt { @{id: elt.id(), span: elt.span(), cat: cat_comp(cmt, comp_tuple), - lp: cmt.lp.map(|l| @lp_comp(l, comp_tuple) ), + lp: cmt.lp.map(|l| @lp_comp(*l, comp_tuple) ), mutbl: cmt.mutbl, // imm iff in an immutable context ty: self.tcx.ty(elt)} } @@ -958,7 +958,7 @@ impl &mem_categorization_ctxt { self.cat_to_repr(cmt.cat), cmt.id, self.mut_to_str(cmt.mutbl), - cmt.lp.map_default(~"none", |p| self.lp_to_str(p) ), + cmt.lp.map_default(~"none", |p| self.lp_to_str(*p) ), ty_to_str(self.tcx, cmt.ty)) } diff --git a/src/rustc/middle/trans/callee.rs b/src/rustc/middle/trans/callee.rs index 470d4dbb4ab..e7b4dd171e3 100644 --- a/src/rustc/middle/trans/callee.rs +++ b/src/rustc/middle/trans/callee.rs @@ -537,7 +537,7 @@ fn trans_arg_expr(bcx: block, ret_flag=%?)", formal_ty.mode, bcx.ty_to_str(formal_ty.ty), bcx.expr_to_str(arg_expr), - ret_flag.map(|v| bcx.val_str(v))); + ret_flag.map(|v| bcx.val_str(*v))); let _indenter = indenter(); // translate the arg expr to a datum diff --git a/src/rustc/middle/trans/common.rs b/src/rustc/middle/trans/common.rs index 0df63e40acf..6f14b22d778 100644 --- a/src/rustc/middle/trans/common.rs +++ b/src/rustc/middle/trans/common.rs @@ -1222,7 +1222,7 @@ fn node_id_type_params(bcx: block, id: ast::node_id) -> ~[ty::t] { fn node_vtables(bcx: block, id: ast::node_id) -> Option { let raw_vtables = bcx.ccx().maps.vtable_map.find(id); raw_vtables.map( - |vts| meth::resolve_vtables_in_fn_ctxt(bcx.fcx, vts)) + |vts| meth::resolve_vtables_in_fn_ctxt(bcx.fcx, *vts)) } fn resolve_vtables_in_fn_ctxt(fcx: fn_ctxt, vts: typeck::vtable_res) diff --git a/src/rustc/middle/trans/glue.rs b/src/rustc/middle/trans/glue.rs index 50a24a1a825..a8a750cd4be 100644 --- a/src/rustc/middle/trans/glue.rs +++ b/src/rustc/middle/trans/glue.rs @@ -192,16 +192,16 @@ fn lazily_emit_simplified_tydesc_glue(ccx: @crate_ctxt, field: uint, lazily_emit_tydesc_glue(ccx, field, simpl_ti); if field == abi::tydesc_field_take_glue { ti.take_glue = - simpl_ti.take_glue.map(|v| cast_glue(ccx, ti, v)); + simpl_ti.take_glue.map(|v| cast_glue(ccx, ti, *v)); } else if field == abi::tydesc_field_drop_glue { ti.drop_glue = - simpl_ti.drop_glue.map(|v| cast_glue(ccx, ti, v)); + simpl_ti.drop_glue.map(|v| cast_glue(ccx, ti, *v)); } else if field == abi::tydesc_field_free_glue { ti.free_glue = - simpl_ti.free_glue.map(|v| cast_glue(ccx, ti, v)); + simpl_ti.free_glue.map(|v| cast_glue(ccx, ti, *v)); } else if field == abi::tydesc_field_visit_glue { ti.visit_glue = - simpl_ti.visit_glue.map(|v| cast_glue(ccx, ti, v)); + simpl_ti.visit_glue.map(|v| cast_glue(ccx, ti, *v)); } return true; } @@ -398,7 +398,7 @@ fn make_free_glue(bcx: block, v: ValueRef, t: ty::t) { ty::ty_class(did, ref substs) => { // Call the dtor if there is one do option::map_default(&ty::ty_dtor(bcx.tcx(), did), bcx) |dt_id| { - trans_class_drop(bcx, v, dt_id, did, substs) + trans_class_drop(bcx, v, *dt_id, did, substs) } } _ => bcx diff --git a/src/rustc/middle/ty.rs b/src/rustc/middle/ty.rs index ed71d27451c..06eb26ec4e7 100644 --- a/src/rustc/middle/ty.rs +++ b/src/rustc/middle/ty.rs @@ -1177,7 +1177,7 @@ fn fold_sty_to_ty(tcx: ty::ctxt, sty: &sty, foldop: fn(t) -> t) -> t { fn fold_sty(sty: &sty, fldop: fn(t) -> t) -> sty { fn fold_substs(substs: &substs, fldop: fn(t) -> t) -> substs { {self_r: substs.self_r, - self_ty: substs.self_ty.map(|t| fldop(t)), + self_ty: substs.self_ty.map(|t| fldop(*t)), tps: substs.tps.map(|t| fldop(*t))} } @@ -1273,8 +1273,8 @@ fn fold_regions_and_ty( fldr: fn(r: region) -> region, fldt: fn(t: t) -> t) -> substs { - {self_r: substs.self_r.map(|r| fldr(r)), - self_ty: substs.self_ty.map(|t| fldt(t)), + {self_r: substs.self_r.map(|r| fldr(*r)), + self_ty: substs.self_ty.map(|t| fldt(*t)), tps: substs.tps.map(|t| fldt(*t))} } @@ -1403,8 +1403,8 @@ fn substs_is_noop(substs: &substs) -> bool { fn substs_to_str(cx: ctxt, substs: &substs) -> ~str { fmt!("substs(self_r=%s, self_ty=%s, tps=%?)", - substs.self_r.map_default(~"none", |r| region_to_str(cx, r)), - substs.self_ty.map_default(~"none", |t| ty_to_str(cx, t)), + substs.self_r.map_default(~"none", |r| region_to_str(cx, *r)), + substs.self_ty.map_default(~"none", |t| ty_to_str(cx, *t)), tys_to_str(cx, substs.tps)) } diff --git a/src/rustc/middle/typeck/check/regionmanip.rs b/src/rustc/middle/typeck/check/regionmanip.rs index aec42f77048..29d4e9927ff 100644 --- a/src/rustc/middle/typeck/check/regionmanip.rs +++ b/src/rustc/middle/typeck/check/regionmanip.rs @@ -37,7 +37,7 @@ fn replace_bound_regions_in_fn_ty( debug!("replace_bound_regions_in_fn_ty(self_info.self_ty=%?, fn_ty=%s, \ all_tys=%?)", - self_ty.map(|t| ty_to_str(tcx, t)), + self_ty.map(|t| ty_to_str(tcx, *t)), ty_to_str(tcx, ty::mk_fn(tcx, *fn_ty)), all_tys.map(|t| ty_to_str(tcx, *t))); let _i = indenter(); @@ -50,11 +50,11 @@ fn replace_bound_regions_in_fn_ty( let t_fn = ty::fold_sty_to_ty(tcx, &ty_fn, |t| { replace_bound_regions(tcx, isr, t) }); - let t_self = self_ty.map(|t| replace_bound_regions(tcx, isr, t)); + let t_self = self_ty.map(|t| replace_bound_regions(tcx, isr, *t)); debug!("result of replace_bound_regions_in_fn_ty: self_info.self_ty=%?, \ fn_ty=%s", - t_self.map(|t| ty_to_str(tcx, t)), + t_self.map(|t| ty_to_str(tcx, *t)), ty_to_str(tcx, t_fn)); diff --git a/src/rustc/middle/typeck/check/vtable.rs b/src/rustc/middle/typeck/check/vtable.rs index 453559e5e42..38ca571dae5 100644 --- a/src/rustc/middle/typeck/check/vtable.rs +++ b/src/rustc/middle/typeck/check/vtable.rs @@ -69,7 +69,7 @@ fn fixup_substs(fcx: @fn_ctxt, expr: @ast::expr, // use a dummy type just to package up the substs that need fixing up let t = ty::mk_trait(tcx, id, substs, ty::vstore_slice(ty::re_static)); do fixup_ty(fcx, expr, t, is_early).map |t_f| { - match ty::get(t_f).sty { + match ty::get(*t_f).sty { ty::ty_trait(_, substs_f, _) => substs_f, _ => fail ~"t_f should be a trait" } diff --git a/src/rustdoc/config.rs b/src/rustdoc/config.rs index d8e79182506..c57e712c020 100644 --- a/src/rustdoc/config.rs +++ b/src/rustdoc/config.rs @@ -141,7 +141,7 @@ fn config_from_opts( let result = result::Ok(config); let result = do result::chain(result) |config| { let output_dir = getopts::opt_maybe_str(matches, opt_output_dir()); - let output_dir = output_dir.map(|s| Path(s)); + let output_dir = output_dir.map(|s| Path(*s)); result::Ok({ output_dir: output_dir.get_default(config.output_dir), .. config @@ -152,7 +152,7 @@ fn config_from_opts( matches, opt_output_format()); do output_format.map_default(result::Ok(config)) |output_format| { - do result::chain(parse_output_format(output_format)) + do result::chain(parse_output_format(*output_format)) |output_format| { result::Ok({ @@ -167,7 +167,7 @@ fn config_from_opts( getopts::opt_maybe_str(matches, opt_output_style()); do output_style.map_default(result::Ok(config)) |output_style| { - do result::chain(parse_output_style(output_style)) + do result::chain(parse_output_style(*output_style)) |output_style| { result::Ok({ output_style: output_style, diff --git a/src/rustdoc/text_pass.rs b/src/rustdoc/text_pass.rs index 76ae3192cef..0da3491c364 100644 --- a/src/rustdoc/text_pass.rs +++ b/src/rustdoc/text_pass.rs @@ -32,7 +32,7 @@ fn run( } fn maybe_apply_op(op: Op, s: Option<~str>) -> Option<~str> { - s.map(|s| op(s) ) + s.map(|s| op(*s) ) } fn fold_item(fold: fold::Fold, doc: doc::ItemDoc) -> doc::ItemDoc {