1
Fork 0

Rollup merge of #93853 - steffahn:map_by_value, r=wesleywiser

Make all `hir::Map` methods consistently by-value

`hir::Map` only consists of a single reference (as part of the contained `TyCtxt`) anyways, so copying is literally zero overhead compared to passing a reference
This commit is contained in:
Matthias Krüger 2022-02-11 07:48:06 +01:00 committed by GitHub
commit ddba967855
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 108 additions and 111 deletions

View file

@ -141,22 +141,22 @@ pub trait Map<'hir> {
// Used when no map is actually available, forcing manual implementation of nested visitors.
impl<'hir> Map<'hir> for ! {
fn find(&self, _: HirId) -> Option<Node<'hir>> {
unreachable!()
*self;
}
fn body(&self, _: BodyId) -> &'hir Body<'hir> {
unreachable!()
*self;
}
fn item(&self, _: ItemId) -> &'hir Item<'hir> {
unreachable!()
*self;
}
fn trait_item(&self, _: TraitItemId) -> &'hir TraitItem<'hir> {
unreachable!()
*self;
}
fn impl_item(&self, _: ImplItemId) -> &'hir ImplItem<'hir> {
unreachable!()
*self;
}
fn foreign_item(&self, _: ForeignItemId) -> &'hir ForeignItem<'hir> {
unreachable!()
*self;
}
}