Skip to content

Commit

Permalink
Replace unecessary calls to .clone() by argument binding pattern fo…
Browse files Browse the repository at this point in the history
…r `Copy` types
  • Loading branch information
marmeladema committed May 21, 2020
1 parent 4c4cb46 commit f31e076
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions src/librustc_resolve/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1342,30 +1342,30 @@ impl<'a> Resolver<'a> {
extern_crate_map: self
.extern_crate_map
.iter()
.map(|(k, v)| (self.definitions.local_def_id(k.clone()).to_def_id(), v.clone()))
.map(|(&k, &v)| (self.definitions.local_def_id(k).to_def_id(), v))
.collect(),
export_map: self
.export_map
.iter()
.map(|(k, v)| {
.map(|(&k, v)| {
(
k.clone(),
k,
v.iter()
.map(|e| e.clone().map_id(|id| self.definitions.node_id_to_hir_id(id)))
.map(|e| e.map_id(|id| self.definitions.node_id_to_hir_id(id)))
.collect(),
)
})
.collect(),
trait_map: self
.trait_map
.iter()
.map(|(k, v)| {
.map(|(&k, v)| {
(
self.definitions.node_id_to_hir_id(k.clone()),
self.definitions.node_id_to_hir_id(k),
v.iter()
.cloned()
.map(|tc| {
tc.clone()
.map_import_ids(|id| self.definitions.node_id_to_hir_id(id))
tc.map_import_ids(|id| self.definitions.node_id_to_hir_id(id))
})
.collect(),
)
Expand All @@ -1374,17 +1374,17 @@ impl<'a> Resolver<'a> {
glob_map: self
.glob_map
.iter()
.map(|(id, names)| (self.definitions.local_def_id(id.clone()), names.clone()))
.map(|(&id, names)| (self.definitions.local_def_id(id), names.clone()))
.collect(),
maybe_unused_trait_imports: self
.maybe_unused_trait_imports
.iter()
.map(|id| self.definitions.local_def_id(id.clone()))
.map(|&id| self.definitions.local_def_id(id))
.collect(),
maybe_unused_extern_crates: self
.maybe_unused_extern_crates
.iter()
.map(|(id, sp)| (self.definitions.local_def_id(id.clone()).to_def_id(), sp.clone()))
.map(|&(id, sp)| (self.definitions.local_def_id(id).to_def_id(), sp))
.collect(),
extern_prelude: self
.extern_prelude
Expand Down

0 comments on commit f31e076

Please sign in to comment.