Skip to content

Commit e2512f7

Browse files
committed
avoid creating vec in methods in ModuleItems
1 parent cb10a9a commit e2512f7

File tree

1 file changed

+2
-2
lines changed
  • compiler/rustc_middle/src/hir/map

1 file changed

+2
-2
lines changed

compiler/rustc_middle/src/hir/map/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,11 +159,11 @@ impl<'hir> Map<'hir> {
159159
}
160160

161161
pub fn items(self) -> impl Iterator<Item = ItemId> + 'hir {
162-
self.tcx.hir_crate_items(()).items.iter().map(|id| *id)
162+
self.tcx.hir_crate_items(()).items.iter().copied()
163163
}
164164

165165
pub fn par_items(self, f: impl Fn(ItemId) + Sync + Send) {
166-
par_for_each_in(self.tcx.hir_crate_items(()).items.to_vec(), f);
166+
par_for_each_in(&self.tcx.hir_crate_items(()).items[..], |id| f(*id));
167167
}
168168

169169
pub fn def_key(self, def_id: LocalDefId) -> DefKey {

0 commit comments

Comments
 (0)