diff options
| author | Joshua Landau <joshua@landau.ws> | 2015-06-11 13:56:07 +0100 |
|---|---|---|
| committer | Joshua Landau <joshua@landau.ws> | 2015-06-11 13:56:07 +0100 |
| commit | d7f5fa4636b12c3dadd626e708ec7cef654faf54 (patch) | |
| tree | 26d1cae1de4f3b8d179cf008e380b6396bd9070f | |
| parent | ca7418b84658fc1c723672c462aa0a7878d88b64 (diff) | |
| download | rust-d7f5fa4636b12c3dadd626e708ec7cef654faf54.tar.gz rust-d7f5fa4636b12c3dadd626e708ec7cef654faf54.zip | |
Conver reborrows to .iter() calls where appropriate
47 files changed, 109 insertions, 109 deletions
diff --git a/src/liballoc/rc.rs b/src/liballoc/rc.rs index 6a9b41c0fe4..906a41a4d53 100644 --- a/src/liballoc/rc.rs +++ b/src/liballoc/rc.rs @@ -130,7 +130,7 @@ //! gadget_owner.gadgets.borrow_mut().push(gadget2.clone().downgrade()); //! //! // Iterate over our Gadgets, printing their details out -//! for gadget_opt in &*gadget_owner.gadgets.borrow() { +//! for gadget_opt in gadget_owner.gadgets.borrow().iter() { //! //! // gadget_opt is a Weak<Gadget>. Since weak pointers can't guarantee //! // that their object is still allocated, we need to call upgrade() diff --git a/src/libarena/lib.rs b/src/libarena/lib.rs index 5817cee24dc..9bd23494da3 100644 --- a/src/libarena/lib.rs +++ b/src/libarena/lib.rs @@ -127,7 +127,7 @@ impl<'longer_than_self> Drop for Arena<'longer_than_self> { fn drop(&mut self) { unsafe { destroy_chunk(&*self.head.borrow()); - for chunk in &*self.chunks.borrow() { + for chunk in self.chunks.borrow().iter() { if !chunk.is_copy.get() { destroy_chunk(chunk); } diff --git a/src/libcollections/vec.rs b/src/libcollections/vec.rs index b87d793d1a8..ceb5d12efcd 100644 --- a/src/libcollections/vec.rs +++ b/src/libcollections/vec.rs @@ -1639,7 +1639,7 @@ impl<T> Drop for Vec<T> { // zeroed (when moving out, because of #[unsafe_no_drop_flag]). if self.cap != 0 && self.cap != mem::POST_DROP_USIZE { unsafe { - for x in &*self { + for x in self.iter() { ptr::read(x); } dealloc(*self.ptr, self.cap) diff --git a/src/libgraphviz/lib.rs b/src/libgraphviz/lib.rs index afd796f7771..f6c5d66f55c 100644 --- a/src/libgraphviz/lib.rs +++ b/src/libgraphviz/lib.rs @@ -558,7 +558,7 @@ pub fn render_opts<'a, N:Clone+'a, E:Clone+'a, G:Labeller<'a,N,E>+GraphWalk<'a,N } try!(writeln(w, &["digraph ", g.graph_id().as_slice(), " {"])); - for n in &*g.nodes() { + for n in g.nodes().iter() { try!(indent(w)); let id = g.node_id(n); if options.contains(&RenderOption::NoNodeLabels) { @@ -570,7 +570,7 @@ pub fn render_opts<'a, N:Clone+'a, E:Clone+'a, G:Labeller<'a,N,E>+GraphWalk<'a,N } } - for e in &*g.edges() { + for e in g.edges().iter() { let escaped_label = g.edge_label(e).escape(); try!(indent(w)); let source = g.source(e); diff --git a/src/librustc/ast_map/mod.rs b/src/librustc/ast_map/mod.rs index 810862cdfd6..06d87f5333a 100644 --- a/src/librustc/ast_map/mod.rs +++ b/src/librustc/ast_map/mod.rs @@ -704,7 +704,7 @@ impl<'ast> Visitor<'ast> for NodeCollector<'ast> { } } ItemTrait(_, _, ref bounds, ref trait_items) => { - for b in &**bounds { + for b in bounds.iter() { if let TraitTyParamBound(ref t, TraitBoundModifier::None) = *b { self.insert(t.trait_ref.ref_id, NodeItem(i)); } diff --git a/src/librustc/lint/context.rs b/src/librustc/lint/context.rs index 9688447dc04..96603d3758e 100644 --- a/src/librustc/lint/context.rs +++ b/src/librustc/lint/context.rs @@ -712,7 +712,7 @@ pub fn check_crate(tcx: &ty::ctxt, // If we missed any lints added to the session, then there's a bug somewhere // in the iteration code. - for (id, v) in &*tcx.sess.lints.borrow() { + for (id, v) in tcx.sess.lints.borrow().iter() { for &(lint, span, ref msg) in v { tcx.sess.span_bug(span, &format!("unprocessed lint {} at {}: {}", diff --git a/src/librustc/metadata/creader.rs b/src/librustc/metadata/creader.rs index dce19d6ff78..8562d8c01cc 100644 --- a/src/librustc/metadata/creader.rs +++ b/src/librustc/metadata/creader.rs @@ -698,7 +698,7 @@ pub fn import_codemap(local_codemap: &codemap::CodeMap, return false; } - for (&line1, &line2) in lines1.iter().zip(&*lines2) { + for (&line1, &line2) in lines1.iter().zip(lines2.iter()) { if (line1 - fm1.start_pos) != (line2 - fm2.start_pos) { return false; } @@ -711,7 +711,7 @@ pub fn import_codemap(local_codemap: &codemap::CodeMap, return false; } - for (mb1, mb2) in multibytes1.iter().zip(&*multibytes2) { + for (mb1, mb2) in multibytes1.iter().zip(multibytes2.iter()) { if (mb1.bytes != mb2.bytes) || ((mb1.pos - fm1.start_pos) != (mb2.pos - fm2.start_pos)) { return false; diff --git a/src/librustc/metadata/cstore.rs b/src/librustc/metadata/cstore.rs index 885e7ffb305..3112e8f4b4c 100644 --- a/src/librustc/metadata/cstore.rs +++ b/src/librustc/metadata/cstore.rs @@ -127,7 +127,7 @@ impl CStore { pub fn iter_crate_data<I>(&self, mut i: I) where I: FnMut(ast::CrateNum, &crate_metadata), { - for (&k, v) in &*self.metas.borrow() { + for (&k, v) in self.metas.borrow().iter() { i(k, &**v); } } @@ -136,7 +136,7 @@ impl CStore { pub fn iter_crate_data_origins<I>(&self, mut i: I) where I: FnMut(ast::CrateNum, &crate_metadata, Option<CrateSource>), { - for (&k, v) in &*self.metas.borrow() { + for (&k, v) in self.metas.borrow().iter() { let origin = self.get_used_crate_source(k); origin.as_ref().map(|cs| { assert!(k == cs.cnum); }); i(k, &**v, origin); @@ -185,7 +185,7 @@ impl CStore { } ordering.push(cnum); }; - for (&num, _) in &*self.metas.borrow() { + for (&num, _) in self.metas.borrow().iter() { visit(self, num, &mut ordering); } ordering.reverse(); diff --git a/src/librustc/metadata/encoder.rs b/src/librustc/metadata/encoder.rs index d6f4c4ca0d0..b217eabec6e 100644 --- a/src/librustc/metadata/encoder.rs +++ b/src/librustc/metadata/encoder.rs @@ -377,7 +377,7 @@ fn encode_reexported_static_base_methods(ecx: &EncodeContext, let impl_items = ecx.tcx.impl_items.borrow(); match ecx.tcx.inherent_impls.borrow().get(&exp.def_id) { Some(implementations) => { - for base_impl_did in &**implementations { + for base_impl_did in implementations.iter() { for &method_did in impl_items.get(base_impl_did).unwrap() { let impl_item = ty::impl_or_trait_item( ecx.tcx, @@ -403,7 +403,7 @@ fn encode_reexported_static_trait_methods(ecx: &EncodeContext, -> bool { match ecx.tcx.trait_items_cache.borrow().get(&exp.def_id) { Some(trait_items) => { - for trait_item in &**trait_items { + for trait_item in trait_items.iter() { if let ty::MethodTraitItem(ref m) = *trait_item { encode_reexported_static_method(rbml_w, exp, @@ -981,7 +981,7 @@ fn encode_inherent_implementations(ecx: &EncodeContext, match ecx.tcx.inherent_impls.borrow().get(&def_id) { None => {} Some(implementations) => { - for &impl_def_id in &**implementations { + for &impl_def_id in implementations.iter() { rbml_w.start_tag(tag_items_data_item_inherent_impl); encode_def_id(rbml_w, impl_def_id); rbml_w.end_tag(); @@ -1348,7 +1348,7 @@ fn encode_info_for_item(ecx: &EncodeContext, encode_attributes(rbml_w, &item.attrs); encode_visibility(rbml_w, vis); encode_stability(rbml_w, stab); - for &method_def_id in &*ty::trait_item_def_ids(tcx, def_id) { + for &method_def_id in ty::trait_item_def_ids(tcx, def_id).iter() { rbml_w.start_tag(tag_item_trait_item); match method_def_id { ty::ConstTraitItemId(const_def_id) => { @@ -1822,8 +1822,8 @@ fn encode_lang_items(ecx: &EncodeContext, rbml_w: &mut Encoder) { fn encode_native_libraries(ecx: &EncodeContext, rbml_w: &mut Encoder) { rbml_w.start_tag(tag_native_libraries); - for &(ref lib, kind) in &*ecx.tcx.sess.cstore.get_used_libraries() - .borrow() { + for &(ref lib, kind) in ecx.tcx.sess.cstore.get_used_libraries() + .borrow().iter() { match kind { cstore::NativeStatic => {} // these libraries are not propagated cstore::NativeFramework | cstore::NativeUnknown => { diff --git a/src/librustc/middle/dead.rs b/src/librustc/middle/dead.rs index c06de29450b..539c0940b70 100644 --- a/src/librustc/middle/dead.rs +++ b/src/librustc/middle/dead.rs @@ -491,8 +491,8 @@ impl<'a, 'tcx> DeadVisitor<'a, 'tcx> { match self.tcx.inherent_impls.borrow().get(&local_def(id)) { None => (), Some(impl_list) => { - for impl_did in &**impl_list { - for item_did in &*impl_items.get(impl_did).unwrap() { + for impl_did in impl_list.iter() { + for item_did in impl_items.get(impl_did).unwrap().iter() { if self.live_symbols.contains(&item_did.def_id() .node) { return true; diff --git a/src/librustc/middle/dependency_format.rs b/src/librustc/middle/dependency_format.rs index 0b688e1e08a..ff5178fbefc 100644 --- a/src/librustc/middle/dependency_format.rs +++ b/src/librustc/middle/dependency_format.rs @@ -85,7 +85,7 @@ pub type Dependencies = FnvHashMap<config::CrateType, DependencyList>; pub fn calculate(tcx: &ty::ctxt) { let mut fmts = tcx.dependency_formats.borrow_mut(); - for &ty in &*tcx.sess.crate_types.borrow() { + for &ty in tcx.sess.crate_types.borrow().iter() { fmts.insert(ty, calculate_type(&tcx.sess, ty)); } tcx.sess.abort_if_errors(); diff --git a/src/librustc/middle/infer/region_inference/mod.rs b/src/librustc/middle/infer/region_inference/mod.rs index 9de362fe360..a6906e7b2d3 100644 --- a/src/librustc/middle/infer/region_inference/mod.rs +++ b/src/librustc/middle/infer/region_inference/mod.rs @@ -1218,7 +1218,7 @@ impl<'a, 'tcx> RegionVarBindings<'a, 'tcx> { errors: &mut Vec<RegionResolutionError<'tcx>>) { let mut reg_reg_dups = FnvHashSet(); - for verify in &*self.verifys.borrow() { + for verify in self.verifys.borrow().iter() { match *verify { VerifyRegSubReg(ref origin, sub, sup) => { if free_regions.is_subregion_of(self.tcx, sub, sup) { @@ -1350,7 +1350,7 @@ impl<'a, 'tcx> RegionVarBindings<'a, 'tcx> { } let dummy_idx = graph.add_node(()); - for (constraint, _) in &*constraints { + for (constraint, _) in constraints.iter() { match *constraint { ConstrainVarSubVar(a_id, b_id) => { graph.add_edge(NodeIndex(a_id.index as usize), @@ -1575,7 +1575,7 @@ impl<'a, 'tcx> RegionVarBindings<'a, 'tcx> { changed = false; iteration += 1; debug!("---- {} Iteration {}{}", "#", tag, iteration); - for (constraint, _) in &*self.constraints.borrow() { + for (constraint, _) in self.constraints.borrow().iter() { let edge_changed = body(constraint); if edge_changed { debug!("Updated due to constraint {}", diff --git a/src/librustc/middle/reachable.rs b/src/librustc/middle/reachable.rs index 378b3c41128..0bbcfa70038 100644 --- a/src/librustc/middle/reachable.rs +++ b/src/librustc/middle/reachable.rs @@ -354,7 +354,7 @@ impl<'a, 'tcx> ReachableContext<'a, 'tcx> { // this properly would result in the necessity of computing *type* // reachability, which might result in a compile time loss. fn mark_destructors_reachable(&mut self) { - for (_, destructor_def_id) in &*self.tcx.destructor_for_type.borrow() { + for (_, destructor_def_id) in self.tcx.destructor_for_type.borrow().iter() { if destructor_def_id.krate == ast::LOCAL_CRATE { self.reachable_symbols.insert(destructor_def_id.node); } diff --git a/src/librustc/middle/region.rs b/src/librustc/middle/region.rs index 2ee5507f402..2a033d36a47 100644 --- a/src/librustc/middle/region.rs +++ b/src/librustc/middle/region.rs @@ -372,22 +372,22 @@ struct RegionResolutionVisitor<'a> { impl RegionMaps { pub fn each_encl_scope<E>(&self, mut e:E) where E: FnMut(&CodeExtent, &CodeExtent) { - for (child, parent) in &*self.scope_map.borrow() { + for (child, parent) in self.scope_map.borrow().iter() { e(child, parent) } } pub fn each_var_scope<E>(&self, mut e:E) where E: FnMut(&ast::NodeId, &CodeExtent) { - for (child, parent) in &*self.var_map.borrow() { + for (child, parent) in self.var_map.borrow().iter() { e(child, parent) } } pub fn each_rvalue_scope<E>(&self, mut e:E) where E: FnMut(&ast::NodeId, &CodeExtent) { - for (child, parent) in &*self.rvalue_scopes.borrow() { + for (child, parent) in self.rvalue_scopes.borrow().iter() { e(child, parent) } } pub fn each_terminating_scope<E>(&self, mut e:E) where E: FnMut(&CodeExtent) { - for scope in &*self.terminating_scopes.borrow() { + for scope in self.terminating_scopes.borrow().iter() { e(scope) } } diff --git a/src/librustc/middle/resolve_lifetime.rs b/src/librustc/middle/resolve_lifetime.rs index dfdcba1678f..9e5ad7b42f5 100644 --- a/src/librustc/middle/resolve_lifetime.rs +++ b/src/librustc/middle/resolve_lifetime.rs @@ -232,7 +232,7 @@ impl<'a, 'v> Visitor<'v> for LifetimeContext<'a> { } fn visit_generics(&mut self, generics: &ast::Generics) { - for ty_param in &*generics.ty_params { + for ty_param in generics.ty_params.iter() { visit::walk_ty_param_bounds_helper(self, &ty_param.bounds); match ty_param.default { Some(ref ty) => self.visit_ty(&**ty), @@ -773,7 +773,7 @@ fn early_bound_lifetime_names(generics: &ast::Generics) -> Vec<ast::Name> { let mut collector = FreeLifetimeCollector { early_bound: &mut early_bound, late_bound: &mut late_bound }; - for ty_param in &*generics.ty_params { + for ty_param in generics.ty_params.iter() { visit::walk_ty_param_bounds_helper(&mut collector, &ty_param.bounds); } for predicate in &generics.where_clause.predicates { diff --git a/src/librustc/middle/traits/error_reporting.rs b/src/librustc/middle/traits/error_reporting.rs index 2b82987480d..2a8dabf006a 100644 --- a/src/librustc/middle/traits/error_reporting.rs +++ b/src/librustc/middle/traits/error_reporting.rs @@ -79,7 +79,7 @@ fn report_on_unimplemented<'a, 'tcx>(infcx: &InferCtxt<'a, 'tcx>, span: Span) -> Option<String> { let def_id = trait_ref.def_id; let mut report = None; - for item in &*ty::get_attrs(infcx.tcx, def_id) { + for item in ty::get_attrs(infcx.tcx, def_id).iter() { if item.check_name("rustc_on_unimplemented") { let err_sp = if item.meta().span == DUMMY_SP { span diff --git a/src/librustc/middle/traits/project.rs b/src/librustc/middle/traits/project.rs index 48ebfe35479..557a02554c3 100644 --- a/src/librustc/middle/traits/project.rs +++ b/src/librustc/middle/traits/project.rs @@ -872,7 +872,7 @@ fn confirm_impl_candidate<'cx,'tcx>( // It is not in the impl - get the default from the trait. let trait_ref = obligation.predicate.trait_ref; - for trait_item in &*ty::trait_items(selcx.tcx(), trait_ref.def_id) { + for trait_item in ty::trait_items(selcx.tcx(), trait_ref.def_id).iter() { if let &ty::TypeTraitItem(ref assoc_ty) = trait_item { if assoc_ty.name == obligation.predicate.item_name { if let Some(ty) = assoc_ty.ty { diff --git a/src/librustc/middle/traits/util.rs b/src/librustc/middle/traits/util.rs index 132a0687b1a..a864ba4498f 100644 --- a/src/librustc/middle/traits/util.rs +++ b/src/librustc/middle/traits/util.rs @@ -431,7 +431,7 @@ pub fn get_vtable_index_of_object_method<'tcx>(tcx: &ty::ctxt<'tcx>, } let trait_items = ty::trait_items(tcx, bound_ref.def_id()); - for trait_item in &**trait_items { + for trait_item in trait_items.iter() { match *trait_item { ty::MethodTraitItem(_) => method_count += 1, _ => {} diff --git a/src/librustc/middle/ty.rs b/src/librustc/middle/ty.rs index cd337f67303..e795c8d521b 100644 --- a/src/librustc/middle/ty.rs +++ b/src/librustc/middle/ty.rs @@ -862,7 +862,7 @@ macro_rules! sty_debug_print { $(let mut $variant = total;)* - for (_, t) in &*tcx.interner.borrow() { + for (_, t) in tcx.interner.borrow().iter() { let variant = match t.sty { ty::ty_bool | ty::ty_char | ty::ty_int(..) | ty::ty_uint(..) | ty::ty_float(..) | ty::ty_str => continue, @@ -2571,7 +2571,7 @@ impl<'tcx> TraitDef<'tcx> { pub fn for_each_impl<F: FnMut(DefId)>(&self, tcx: &ctxt<'tcx>, mut f: F) { ty::populate_implementations_for_trait_if_necessary(tcx, self.trait_ref.def_id); - for &impl_def_id in &*self.blanket_impls.borrow() { + for &impl_def_id in self.blanket_impls.borrow().iter() { f(impl_def_id); } @@ -2589,7 +2589,7 @@ impl<'tcx> TraitDef<'tcx> { { ty::populate_implementations_for_trait_if_necessary(tcx, self.trait_ref.def_id); - for &impl_def_id in &*self.blanket_impls.borrow() { + for &impl_def_id in self.blanket_impls.borrow().iter() { f(impl_def_id); } @@ -7207,7 +7207,7 @@ pub fn can_type_implement_copy<'a,'tcx>(param_env: &ParameterEnvironment<'a, 'tc } ty::ty_enum(enum_did, substs) => { let enum_variants = ty::enum_variants(tcx, enum_did); - for variant in &*enum_variants { + for variant in enum_variants.iter() { for variant_arg_type in &variant.args { let substd_arg_type = variant_arg_type.subst(tcx, substs); diff --git a/src/librustc_borrowck/borrowck/move_data.rs b/src/librustc_borrowck/borrowck/move_data.rs index 1180717140e..0f56aa9fb1f 100644 --- a/src/librustc_borrowck/borrowck/move_data.rs +++ b/src/librustc_borrowck/borrowck/move_data.rs @@ -478,14 +478,14 @@ impl<'tcx> MoveData<'tcx> { KillFrom::Execution, dfcx_moves); } - for assignment in &*self.path_assignments.borrow() { + for assignment in self.path_assignments.borrow().iter() { self.kill_moves(assignment.path, assignment.id, KillFrom::Execution, dfcx_moves); } // Kill all moves related to a variable `x` when // it goes out of scope: - for path in &*self.paths.borrow() { + for path in self.paths.borrow().iter() { match path.loan_path.kind { LpVar(..) | LpUpvar(..) | LpDowncast(..) => { let kill_scope = path.loan_path.kill_scope(tcx); diff --git a/src/librustc_driver/driver.rs b/src/librustc_driver/driver.rs index a9c7d22c370..cc22083f5ae 100644 --- a/src/librustc_driver/driver.rs +++ b/src/librustc_driver/driver.rs @@ -792,7 +792,7 @@ fn write_out_deps(sess: &Session, let file = outputs.path(*output_type); match *output_type { config::OutputTypeExe => { - for output in &*sess.crate_types.borrow() { + for output in sess.crate_types.borrow().iter() { let p = link::filename_for_input(sess, *output, id, &file); out_filenames.push(p); diff --git a/src/librustc_lint/builtin.rs b/src/librustc_lint/builtin.rs index 9c87f8a98db..e1bf37138f3 100644 --- a/src/librustc_lint/builtin.rs +++ b/src/librustc_lint/builtin.rs @@ -645,7 +645,7 @@ impl LintPass for UnusedAttributes { } let plugin_attributes = cx.sess().plugin_attributes.borrow_mut(); - for &(ref name, ty) in &*plugin_attributes { + for &(ref name, ty) in plugin_attributes.iter() { if ty == AttributeType::Whitelisted && attr.check_name(&*name) { break; } @@ -860,7 +860,7 @@ impl LintPass for NonCamelCaseTypes { } fn check_generics(&mut self, cx: &Context, it: &ast::Generics) { - for gen in &*it.ty_params { + for gen in it.ty_params.iter() { self.check_case(cx, "type parameter", gen.ident, gen.span); } } @@ -2249,7 +2249,7 @@ impl LintPass for DropWithReprExtern { lint_array!(DROP_WITH_REPR_EXTERN) } fn check_crate(&mut self, ctx: &Context, _: &ast::Crate) { - for dtor_did in &*ctx.tcx.destructors.borrow() { + for dtor_did in ctx.tcx.destructors.borrow().iter() { let (drop_impl_did, dtor_self_type) = if dtor_did.krate == ast::LOCAL_CRATE { let impl_did = ctx.tcx.map.get_parent_did(dtor_did.node); diff --git a/src/librustc_privacy/lib.rs b/src/librustc_privacy/lib.rs index 67bc4a8a7f3..2e8e576732b 100644 --- a/src/librustc_privacy/lib.rs +++ b/src/librustc_privacy/lib.rs @@ -1301,7 +1301,7 @@ impl<'a, 'tcx, 'v> Visitor<'v> for VisiblePrivateTypesVisitor<'a, 'tcx> { return } - for bound in &**bounds { + for bound in bounds.iter() { self.check_ty_param_bound(bound) } } @@ -1466,15 +1466,15 @@ impl<'a, 'tcx, 'v> Visitor<'v> for VisiblePrivateTypesVisitor<'a, 'tcx> { } fn visit_generics(&mut self, generics: &ast::Generics) { - for ty_param in &*generics.ty_params { - for bound in &*ty_param.bounds { + for ty_param in generics.ty_params.iter() { + for bound in ty_param.bounds.iter() { self.check_ty_param_bound(bound) } } for predicate in &generics.where_clause.predicates { match predicate { &ast::WherePredicate::BoundPredicate(ref bound_pred) => { - for bound in &*bound_pred.bounds { + for bound in bound_pred.bounds.iter() { self.check_ty_param_bound(bound) } } diff --git a/src/librustc_resolve/lib.rs b/src/librustc_resolve/lib.rs index 455aea9448e..c47922dd954 100644 --- a/src/librustc_resolve/lib.rs +++ b/src/librustc_resolve/lib.rs @@ -1574,7 +1574,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> { // Descend into children and anonymous children. build_reduced_graph::populate_module_if_necessary(self, &module_); - for (_, child_node) in &*module_.children.borrow() { + for (_, child_node) in module_.children.borrow().iter() { match child_node.get_module_if_available() { None => { // Continue. @@ -1585,7 +1585,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> { } } - for (_, module_) in &*module_.anonymous_children.borrow() { + for (_, module_) in module_.anonymous_children.borrow().iter() { self.report_unresolved_imports(module_.clone()); } } @@ -2039,7 +2039,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> { } fn resolve_generics(&mut self, generics: &Generics) { - for type_parameter in &*generics.ty_params { + for type_parameter in generics.ty_params.iter() { self.check_if_primitive_type_name(type_parameter.ident.name, type_parameter.span); } for predicate in &generics.where_clause.predicates { @@ -3502,7 +3502,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> { build_reduced_graph::populate_module_if_necessary(self, &search_module); { - for (_, child_names) in &*search_module.children.borrow() { + for (_, child_names) in search_module.children.borrow().iter() { let def = match child_names.def_for_namespace(TypeNS) { Some(def) => def, None => continue @@ -3518,7 +3518,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> { } // Look for imports. - for (_, import) in &*search_module.import_resolutions.borrow() { + for (_, import) in search_module.import_resolutions.borrow().iter() { let target = match import.target_for_namespace(TypeNS) { None => continue, Some(target) => target, @@ -3591,13 +3591,13 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> { debug!("Children:"); build_reduced_graph::populate_module_if_necessary(self, &module_); - for (&name, _) in &*module_.children.borrow() { + for (&name, _) in module_.children.borrow().iter() { debug!("* {}", token::get_name(name)); } debug!("Import resolutions:"); let import_resolutions = module_.import_resolutions.borrow(); - for (&name, import_resolution) in &*import_resolutions { + for (&name, import_resolution) in import_resolutions.iter() { let value_repr; match import_resolution.target_for_namespace(ValueNS) { None => { value_repr = "".to_string(); } diff --git a/src/librustc_resolve/record_exports.rs b/src/librustc_resolve/record_exports.rs index e953b6398f9..3a566a9672f 100644 --- a/src/librustc_resolve/record_exports.rs +++ b/src/librustc_resolve/record_exports.rs @@ -81,7 +81,7 @@ impl<'a, 'b, 'tcx> ExportRecorder<'a, 'b, 'tcx> { self.record_exports_for_module(&*module_); build_reduced_graph::populate_module_if_necessary(self.resolver, &module_); - for (_, child_name_bindings) in &*module_.children.borrow() { + for (_, child_name_bindings) in module_.children.borrow().iter() { match child_name_bindings.get_module_if_available() { None => { // Nothing to do. @@ -92,7 +92,7 @@ impl<'a, 'b, 'tcx> ExportRecorder<'a, 'b, 'tcx> { } } - for (_, child_module) in &*module_.anonymous_children.borrow() { + for (_, child_module) in module_.anonymous_children.borrow().iter() { self.record_exports_for_module_subtree(child_module.clone()); } } @@ -134,7 +134,7 @@ impl<'a, 'b, 'tcx> ExportRecorder<'a, 'b, 'tcx> { fn add_exports_for_module(&mut self, exports: &mut Vec<Export>, module_: &Module) { - for (name, import_resolution) in &*module_.import_resolutions.borrow() { + for (name, import_resolution) in module_.import_resolutions.borrow().iter() { if !import_resolution.is_public { continue } diff --git a/src/librustc_resolve/resolve_imports.rs b/src/librustc_resolve/resolve_imports.rs index 9870b41e7fa..71a63e24faf 100644 --- a/src/librustc_resolve/resolve_imports.rs +++ b/src/librustc_resolve/resolve_imports.rs @@ -234,7 +234,7 @@ impl<'a, 'b:'a, 'tcx:'b> ImportResolver<'a, 'b, 'tcx> { self.resolver.current_module = orig_module; build_reduced_graph::populate_module_if_necessary(self.resolver, &module_); - for (_, child_node) in &*module_.children.borrow() { + for (_, child_node) in module_.children.borrow().iter() { match child_node.get_module_if_available() { None => { // Nothing to do. @@ -245,7 +245,7 @@ impl<'a, 'b:'a, 'tcx:'b> ImportResolver<'a, 'b, 'tcx> { } } - for (_, child_module) in &*module_.anonymous_children.borrow() { + for (_, child_module) in module_.anonymous_children.borrow().iter() { self.resolve_imports_for_module_subtree(child_module.clone()); } } @@ -732,7 +732,7 @@ impl<'a, 'b:'a, 'tcx:'b> ImportResolver<'a, 'b, 'tcx> { // Add all resolved imports from the containing module. let import_resolutions = target_module.import_resolutions.borrow(); - for (ident, target_import_resolution) in &*import_resolutions { + for (ident, target_import_resolution) in import_resolutions.iter() { debug!("(resolving glob import) writing module resolution \ {} into `{}`", token::get_name(*ident), @@ -793,7 +793,7 @@ impl<'a, 'b:'a, 'tcx:'b> ImportResolver<'a, 'b, 'tcx> { // Add all children from the containing module. build_reduced_graph::populate_module_if_necessary(self.resolver, &target_module); - for (&name, name_bindings) in &*target_module.children.borrow() { + for (&name, name_bindings) in target_module.children.borrow().iter() { self.merge_import_resolution(module_, target_module.clone(), import_directive, @@ -803,7 +803,7 @@ impl<'a, 'b:'a, 'tcx:'b> ImportResolver<'a, 'b, 'tcx> { } // Add external module children from the containing module. - for (&name, module) in &*target_module.external_module_children.borrow() { + for (&name, module) in target_module.external_module_children.borrow().iter() { let name_bindings = Rc::new(Resolver::create_name_bindings_from_module(module.clone())); self.merge_import_resolution(module_, diff --git a/src/librustc_trans/back/link.rs b/src/librustc_trans/back/link.rs index 6d51ae50ea0..e2c816bb84d 100644 --- a/src/librustc_trans/back/link.rs +++ b/src/librustc_trans/back/link.rs @@ -204,7 +204,7 @@ fn symbol_hash<'tcx>(tcx: &ty::ctxt<'tcx>, symbol_hasher.input_str(&link_meta.crate_name); symbol_hasher.input_str("-"); symbol_hasher.input_str(link_meta.crate_hash.as_str()); - for meta in &*tcx.sess.crate_metadata.borrow() { + for meta in tcx.sess.crate_metadata.borrow().iter() { symbol_hasher.input_str(&meta[..]); } symbol_hasher.input_str("-"); @@ -389,7 +389,7 @@ pub fn link_binary(sess: &Session, outputs: &OutputFilenames, crate_name: &str) -> Vec<PathBuf> { let mut out_filenames = Vec::new(); - for &crate_type in &*sess.crate_types.borrow() { + for &crate_type in sess.crate_types.borrow().iter() { if invalid_output_for_target(sess, crate_type) { sess.bug(&format!("invalid output type `{:?}` for target os `{}`", crate_type, sess.opts.target_triple)); @@ -559,7 +559,7 @@ fn link_rlib<'a>(sess: &'a Session, let mut ab = ArchiveBuilder::create(config); ab.add_file(obj_filename).unwrap(); - for &(ref l, kind) in &*sess.cstore.get_used_libraries().borrow() { + for &(ref l, kind) in sess.cstore.get_used_libraries().borrow().iter() { match kind { cstore::NativeStatic => ab.add_native_library(&l).unwrap(), cstore::NativeFramework | cstore::NativeUnknown => {} @@ -918,7 +918,7 @@ fn link_args(cmd: &mut Linker, let empty_vec = Vec::new(); let empty_str = String::new(); let args = sess.opts.cg.link_args.as_ref().unwrap_or(&empty_vec); - let mut args = args.iter().chain(&*used_link_args); + let mut args = args.iter().chain(used_link_args.iter()); let relocation_model = sess.opts.cg.relocation_model.as_ref() .unwrap_or(&empty_str); if (t.options.relocation_model == "pic" || *relocation_model == "pic") diff --git a/src/librustc_trans/back/lto.rs b/src/librustc_trans/back/lto.rs index 6457140bcc0..e13a5e97f75 100644 --- a/src/librustc_trans/back/lto.rs +++ b/src/librustc_trans/back/lto.rs @@ -31,7 +31,7 @@ pub fn run(sess: &session::Session, llmod: ModuleRef, } // Make sure we actually can run LTO - for crate_type in &*sess.crate_types.borrow() { + for crate_type in sess.crate_types.borrow().iter() { match *crate_type { config::CrateTypeExecutable | config::CrateTypeStaticlib => {} _ => { diff --git a/src/librustc_trans/save/dump_csv.rs b/src/librustc_trans/save/dump_csv.rs index e0fad66bdd8..0f090aab878 100644 --- a/src/librustc_trans/save/dump_csv.rs +++ b/src/librustc_trans/save/dump_csv.rs @@ -727,7 +727,7 @@ impl <'l, 'tcx> DumpCsvVisitor<'l, 'tcx> { &val); // super-traits - for super_bound in &**trait_refs { + for super_bound in trait_refs.iter() { let trait_ref = match *super_bound { ast::TraitTyParamBound(ref trait_ref, _) => { trait_ref @@ -1202,8 +1202,8 @@ impl<'l, 'tcx, 'v> Visitor<'v> for DumpCsvVisitor<'l, 'tcx> { } fn visit_generics(&mut self, generics: &ast::Generics) { - for param in &*generics.ty_params { - for bound in &*param.bounds { + for param in generics.ty_params.iter() { + for bound in param.bounds.iter() { if let ast::TraitTyParamBound(ref trait_ref, _) = *bound { self.process_trait_ref(&trait_ref.trait_ref); } diff --git a/src/librustc_trans/trans/base.rs b/src/librustc_trans/trans/base.rs index ddb6b9f7067..aad986cd34a 100644 --- a/src/librustc_trans/trans/base.rs +++ b/src/librustc_trans/trans/base.rs @@ -233,7 +233,7 @@ pub fn get_extern_const<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>, did: ast::DefId, // don't do this then linker errors can be generated where the linker // complains that one object files has a thread local version of the // symbol and another one doesn't. - for attr in &*ty::get_attrs(ccx.tcx(), did) { + for attr in ty::get_attrs(ccx.tcx(), did).iter() { if attr.check_name("thread_local") { llvm::set_thread_local(c, true); } @@ -2698,7 +2698,7 @@ pub fn trans_crate<'tcx>(analysis: ty::CrateAnalysis<'tcx>) stats.fn_stats.borrow_mut().sort_by(|&(_, insns_a), &(_, insns_b)| { insns_b.cmp(&insns_a) }); - for tuple in &*stats.fn_stats.borrow() { + for tuple in stats.fn_stats.borrow().iter() { match *tuple { (ref name, insns) => { println!("{} insns, {}", insns, *name); @@ -2707,7 +2707,7 @@ pub fn trans_crate<'tcx>(analysis: ty::CrateAnalysis<'tcx>) } } if shared_ccx.sess().count_llvm_insns() { - for (k, v) in &*shared_ccx.stats().llvm_insns.borrow() { + for (k, v) in shared_ccx.stats().llvm_insns.borrow().iter() { println!("{:7} {}", *v, *k); } } diff --git a/src/librustc_trans/trans/inline.rs b/src/librustc_trans/trans/inline.rs index da98b8a43cb..f860fe44f28 100644 --- a/src/librustc_trans/trans/inline.rs +++ b/src/librustc_trans/trans/inline.rs @@ -106,7 +106,7 @@ fn instantiate_inline(ccx: &CrateContext, fn_id: ast::DefId) ast::ItemEnum(_, _) => { let vs_here = ty::enum_variants(ccx.tcx(), local_def(item.id)); let vs_there = ty::enum_variants(ccx.tcx(), parent_id); - for (here, there) in vs_here.iter().zip(&*vs_there) { + for (here, there) in vs_here.iter().zip(vs_there.iter()) { if there.id == fn_id { my_id = here.id.node; } ccx.external().borrow_mut().insert(there.id, Some(here.id.node)); } diff --git a/src/librustc_trans/trans/intrinsic.rs b/src/librustc_trans/trans/intrinsic.rs index 4a7268f5dfe..4347d1853be 100644 --- a/src/librustc_trans/trans/intrinsic.rs +++ b/src/librustc_trans/trans/intrinsic.rs @@ -93,7 +93,7 @@ pub fn get_simple_intrinsic(ccx: &CrateContext, item: &ast::ForeignItem) -> Opti /// the only intrinsic that needs such verification is `transmute`. pub fn check_intrinsics(ccx: &CrateContext) { let mut last_failing_id = None; - for transmute_restriction in &*ccx.tcx().transmute_restrictions.borrow() { + for transmute_restriction in ccx.tcx().transmute_restrictions.borrow().iter() { // Sometimes, a single call to transmute will push multiple // type pairs to test in order to exhaustively test the // possibility around a type parameter. If one of those fails, diff --git a/src/librustc_typeck/check/method/probe.rs b/src/librustc_typeck/check/method/probe.rs index 1bef5cb19db..1b176015a3a 100644 --- a/src/librustc_typeck/check/method/probe.rs +++ b/src/librustc_typeck/check/method/probe.rs @@ -260,7 +260,7 @@ impl<'a,'tcx> ProbeContext<'a,'tcx> { fn assemble_inherent_candidates(&mut self) { let steps = self.steps.clone(); - for step in &*steps { + for step in steps.iter() { self.assemble_probe(step.self_ty); } } @@ -374,7 +374,7 @@ impl<'a,'tcx> ProbeContext<'a,'tcx> { ty::populate_inherent_implementations_for_type_if_necessary(self.tcx(), def_id); if let Some(impl_infos) = self.tcx().inherent_impls.borrow().get(&def_id) { - for &impl_def_id in &***impl_infos { + for &impl_def_id in impl_infos.iter() { self.assemble_inherent_impl_probe(impl_def_id); } } @@ -700,7 +700,7 @@ impl<'a,'tcx> ProbeContext<'a,'tcx> { // Check if there is an unboxed-closure self-type in the list of receivers. // If so, add "synthetic impls". let steps = self.steps.clone(); - for step in &*steps { + for step in steps.iter() { let closure_def_id = match step.self_ty.sty { ty::ty_closure(a, _) => a, _ => continue, @@ -754,7 +754,7 @@ impl<'a,'tcx> ProbeContext<'a,'tcx> { item.repr(self.tcx()), item_index); - for step in &*self.steps { + for step in self.steps.iter() { debug!("assemble_projection_candidates: step={}", step.repr(self.tcx())); diff --git a/src/librustc_typeck/check/mod.rs b/src/librustc_typeck/check/mod.rs index c8bf83a049b..601db229c41 100644 --- a/src/librustc_typeck/check/mod.rs +++ b/src/librustc_typeck/check/mod.rs @@ -482,7 +482,7 @@ pub fn check_item_types(ccx: &CrateCtxt) { ccx.tcx.sess.abort_if_errors(); - for drop_method_did in &*ccx.tcx.destructors.borrow() { + for drop_method_did in ccx.tcx.destructors.borrow().iter() { if drop_method_did.krate == ast::LOCAL_CRATE { let drop_impl_did = ccx.tcx.map.get_parent_did(drop_method_did.node); match dropck::check_drop_impl(ccx.tcx, drop_impl_did) { @@ -1071,7 +1071,7 @@ fn check_impl_items_against_trait<'a, 'tcx>(ccx: &CrateCtxt<'a, 'tcx>, let provided_methods = ty::provided_trait_methods(tcx, impl_trait_ref.def_id); let associated_consts = ty::associated_consts(tcx, impl_trait_ref.def_id); let mut missing_items = Vec::new(); - for trait_item in &*trait_items { + for trait_item in trait_items.iter() { match *trait_item { ty::ConstTraitItem(ref associated_const) => { let is_implemented = impl_items.iter().any(|ii| { @@ -4292,7 +4292,7 @@ pub fn check_enum_variants<'a,'tcx>(ccx: &CrateCtxt<'a,'tcx>, // we need not check for that. let variants = ty::enum_variants(ccx.tcx, def_id); - for (v, variant) in vs.iter().zip(&*variants) { + for (v, variant) in vs.iter().zip(variants.iter()) { let current_disr_val = variant.disr_val; // Check for duplicate discriminant values diff --git a/src/librustc_typeck/check/writeback.rs b/src/librustc_typeck/check/writeback.rs index 7eba4c0375f..3ecef67ed98 100644 --- a/src/librustc_typeck/check/writeback.rs +++ b/src/librustc_typeck/check/writeback.rs @@ -205,7 +205,7 @@ impl<'cx, 'tcx> WritebackCx<'cx, 'tcx> { return; } - for (upvar_id, upvar_capture) in &*self.fcx.inh.upvar_capture_map.borrow() { + for (upvar_id, upvar_capture) in self.fcx.inh.upvar_capture_map.borrow().iter() { let new_upvar_capture = match *upvar_capture { ty::UpvarCapture::ByValue => ty::UpvarCapture::ByValue, ty::UpvarCapture::ByRef(ref upvar_borrow) => { @@ -227,12 +227,12 @@ impl<'cx, 'tcx> WritebackCx<'cx, 'tcx> { return } - for (def_id, closure_ty) in &*self.fcx.inh.closure_tys.borrow() { + for (def_id, closure_ty) in self.fcx.inh.closure_tys.borrow().iter() { let closure_ty = self.resolve(closure_ty, ResolvingClosure(*def_id)); self.fcx.tcx().closure_tys.borrow_mut().insert(*def_id, closure_ty); } - for (def_id, &closure_kind) in &*self.fcx.inh.closure_kinds.borrow() { + for (def_id, &closure_kind) in self.fcx.inh.closure_kinds.borrow().iter() { self.fcx.tcx().closure_kinds.borrow_mut().insert(*def_id, closure_kind); } } diff --git a/src/librustc_typeck/coherence/mod.rs b/src/librustc_typeck/coherence/mod.rs index 083039a468a..f48e9f73db3 100644 --- a/src/librustc_typeck/coherence/mod.rs +++ b/src/librustc_typeck/coherence/mod.rs @@ -119,7 +119,7 @@ impl<'a, 'tcx> CoherenceChecker<'a, 'tcx> { // the tcx. let mut tcx_inherent_impls = self.crate_context.tcx.inherent_impls.borrow_mut(); - for (k, v) in &*self.inherent_impls.borrow() { + for (k, v) in self.inherent_impls.borrow().iter() { tcx_inherent_impls.insert((*k).clone(), Rc::new((*v.borrow()).clone())); } diff --git a/src/librustc_typeck/collect.rs b/src/librustc_typeck/collect.rs index 3810abb7fe0..012b6f8e52b 100644 --- a/src/librustc_typeck/collect.rs +++ b/src/librustc_typeck/collect.rs @@ -516,7 +516,7 @@ impl<'tcx> GetTypeParameterBounds<'tcx> for ast::Generics { self.ty_params .iter() .filter(|p| p.id == node_id) - .flat_map(|p| &*p.bounds) + .flat_map(|p| p.bounds.iter()) .flat_map(|b| predicates_from_bound(astconv, ty, b)); let from_where_clauses = @@ -528,7 +528,7 @@ impl<'tcx> GetTypeParameterBounds<'tcx> for ast::Generics { _ => None }) .filter(|bp| is_param(astconv.tcx(), &bp.bounded_ty, node_id)) - .flat_map(|bp| &*bp.bounds) + .flat_map(|bp| bp.bounds.iter()) .flat_map(|b| predicates_from_bound(astconv, ty, b)); from_ty_params.chain(from_where_clauses).collect() @@ -777,8 +777,8 @@ fn ensure_no_ty_param_bounds(ccx: &CrateCtxt, thing: &'static str) { let mut warn = false; - for ty_param in &*generics.ty_params { - for bound in &*ty_param.bounds { + for ty_param in generics.ty_params.iter() { + for bound in ty_param.bounds.iter() { match *bound { ast::TraitTyParamBound(..) => { warn = true; @@ -1778,7 +1778,7 @@ fn ty_generic_predicates<'a,'tcx>(ccx: &CrateCtxt<'a,'tcx>, &ExplicitRscope, &*bound_pred.bounded_ty); - for bound in &*bound_pred.bounds { + for bound in bound_pred.bounds.iter() { match bound { &ast::TyParamBound::TraitTyParamBound(ref poly_trait_ref, _) => { let mut projections = Vec::new(); diff --git a/src/librustdoc/clean/inline.rs b/src/librustdoc/clean/inline.rs index aa364c4c746..fcf45f21a1e 100644 --- a/src/librustdoc/clean/inline.rs +++ b/src/librustdoc/clean/inline.rs @@ -228,7 +228,7 @@ pub fn build_impls(cx: &DocContext, tcx: &ty::ctxt, match tcx.inherent_impls.borrow().get(&did) { None => {} Some(i) => { - for &did in &**i { + for &did in i.iter() { build_impl(cx, tcx, did, &mut impls); } } diff --git a/src/librustdoc/html/render.rs b/src/librustdoc/html/render.rs index 9669492cb99..c23cfd298aa 100644 --- a/src/librustdoc/html/render.rs +++ b/src/librustdoc/html/render.rs @@ -471,7 +471,7 @@ fn build_index(krate: &clean::Crate, cache: &mut Cache) -> io::Result<String> { // Reduce `NodeId` in paths into smaller sequential numbers, // and prune the paths that do not appear in the index. - for item in &*search_index { + for item in search_index.iter() { match item.parent { Some(nodeid) => { if !nodeid_to_pathid.contains_key(&nodeid) { diff --git a/src/libstd/thread/local.rs b/src/libstd/thread/local.rs index cdd7dff0108..69a26cdc490 100644 --- a/src/libstd/thread/local.rs +++ b/src/libstd/thread/local.rs @@ -368,7 +368,7 @@ mod imp { unsafe extern fn run_dtors(mut ptr: *mut u8) { while !ptr.is_null() { let list: Box<List> = Box::from_raw(ptr as *mut List); - for &(ptr, dtor) in &*list { + for &(ptr, dtor) in list.iter() { dtor(ptr); } ptr = DTORS.get(); diff --git a/src/libsyntax/ast_util.rs b/src/libsyntax/ast_util.rs index 423996ce6d0..7d7ea371ba5 100644 --- a/src/libsyntax/ast_util.rs +++ b/src/libsyntax/ast_util.rs @@ -330,7 +330,7 @@ pub struct IdVisitor<'a, O:'a> { impl<'a, O: IdVisitingOperation> IdVisitor<'a, O> { fn visit_generics_helper(&mut self, generics: &Generics) { - for type_parameter in &*generics.ty_params { + for type_parameter in generics.ty_params.iter() { self.operation.visit_id(type_parameter.id) } for lifetime in &generics.lifetimes { diff --git a/src/libsyntax/codemap.rs b/src/libsyntax/codemap.rs index b2a366ec5be..98225d10400 100644 --- a/src/libsyntax/codemap.rs +++ b/src/libsyntax/codemap.rs @@ -796,7 +796,7 @@ impl CodeMap { } pub fn get_filemap(&self, filename: &str) -> Rc<FileMap> { - for fm in &*self.files.borrow() { + for fm in self.files.borrow().iter() { if filename == fm.name { return fm.clone(); } @@ -821,7 +821,7 @@ impl CodeMap { // The number of extra bytes due to multibyte chars in the FileMap let mut total_extra_bytes = 0; - for mbc in &*map.multibyte_chars.borrow() { + for mbc in map.multibyte_chars.borrow().iter() { debug!("{}-byte char at {:?}", mbc.bytes, mbc.pos); if mbc.pos < bpos { // every character is at least one byte, so we only diff --git a/src/libsyntax/ext/deriving/generic/mod.rs b/src/libsyntax/ext/deriving/generic/mod.rs index 3c432739111..ec3006898f3 100644 --- a/src/libsyntax/ext/deriving/generic/mod.rs +++ b/src/libsyntax/ext/deriving/generic/mod.rs @@ -505,7 +505,7 @@ impl<'a> TraitDef<'a> { bounds.push(cx.typarambound(trait_path.clone())); // also add in any bounds from the declaration - for declared_bound in &*ty_param.bounds { + for declared_bound in ty_param.bounds.iter() { bounds.push((*declared_bound).clone()); } diff --git a/src/libsyntax/print/pprust.rs b/src/libsyntax/print/pprust.rs index 8958370fda5..3adb73cfa5d 100644 --- a/src/libsyntax/print/pprust.rs +++ b/src/libsyntax/print/pprust.rs @@ -2110,7 +2110,7 @@ impl<'a> State<'a> { comma = true; } - for binding in &*data.bindings { + for binding in data.bindings.iter() { if comma { try!(self.word_space(",")) } @@ -2845,7 +2845,7 @@ impl<'a> State<'a> { } ast::LitBinary(ref v) => { let mut escaped: String = String::new(); - for &ch in &**v { + for &ch in v.iter() { escaped.extend(ascii::escape_default(ch) .map(|c| c as char)); } diff --git a/src/libsyntax/visit.rs b/src/libsyntax/visit.rs index 61fddd6bed8..710928a00c1 100644 --- a/src/libsyntax/visit.rs +++ b/src/libsyntax/visit.rs @@ -428,13 +428,13 @@ pub fn walk_path_parameters<'v, V: Visitor<'v>>(visitor: &mut V, path_parameters: &'v PathParameters) { match *path_parameters { ast::AngleBracketedParameters(ref data) => { - for typ in &*data.types { + for typ in data.types.iter() { visitor.visit_ty(&**typ); } for lifetime in &data.lifetimes { visitor.visit_lifetime_ref(lifetime); } - for binding in &*data.bindings { + for binding in data.bindings.iter() { visitor.visit_assoc_type_binding(&**binding); } } @@ -531,7 +531,7 @@ pub fn walk_foreign_item<'v, V: Visitor<'v>>(visitor: &mut V, pub fn walk_ty_param_bounds_helper<'v, V: Visitor<'v>>(visitor: &mut V, bounds: &'v OwnedSlice<TyParamBound>) { - for bound in &**bounds { + for bound in bounds.iter() { visitor.visit_ty_param_bound(bound) } } @@ -549,7 +549,7 @@ pub fn walk_ty_param_bound<'v, V: Visitor<'v>>(visitor: &mut V, } pub fn walk_generics<'v, V: Visitor<'v>>(visitor: &mut V, generics: &'v Generics) { - for param in &*generics.ty_params { + for param in generics.ty_params.iter() { visitor.visit_ident(param.span, param.ident); walk_ty_param_bounds_helper(visitor, ¶m.bounds); walk_ty_opt(visitor, ¶m.default); diff --git a/src/test/bench/shootout-nbody.rs b/src/test/bench/shootout-nbody.rs index 368dbbb931c..5ba678ce183 100644 --- a/src/test/bench/shootout-nbody.rs +++ b/src/test/bench/shootout-nbody.rs @@ -158,7 +158,7 @@ fn offset_momentum(bodies: &mut [Planet;N_BODIES]) { let mut px = 0.0; let mut py = 0.0; let mut pz = 0.0; - for bi in &*bodies { + for bi in bodies.iter() { px += bi.vx * bi.mass; py += bi.vy * bi.mass; pz += bi.vz * bi.mass; diff --git a/src/test/run-pass/trait-bounds-in-arc.rs b/src/test/run-pass/trait-bounds-in-arc.rs index 250ed58a8ef..9aa2badd80b 100644 --- a/src/test/run-pass/trait-bounds-in-arc.rs +++ b/src/test/run-pass/trait-bounds-in-arc.rs @@ -100,13 +100,13 @@ pub fn main() { fn check_legs(arc: Arc<Vec<Box<Pet+Sync+Send>>>) { let mut legs = 0; - for pet in &*arc { + for pet in arc.iter() { legs += pet.num_legs(); } assert!(legs == 12); } fn check_names(arc: Arc<Vec<Box<Pet+Sync+Send>>>) { - for pet in &*arc { + for pet in arc.iter() { // FIXME (#22405): Replace `Box::new` with `box` here when/if possible. pet.name(Box::new(|name| { assert!(name.as_bytes()[0] == 'a' as u8 && name.as_bytes()[1] == 'l' as u8); @@ -114,7 +114,7 @@ fn check_names(arc: Arc<Vec<Box<Pet+Sync+Send>>>) { } } fn check_pedigree(arc: Arc<Vec<Box<Pet+Sync+Send>>>) { - for pet in &*arc { + for pet in arc.iter() { assert!(pet.of_good_pedigree()); } } |
