Skip to content

Commit

Permalink
Use entry API in store_path
Browse files Browse the repository at this point in the history
  • Loading branch information
Mark-Simulacrum committed Aug 11, 2019
1 parent 00d7bc7 commit 8f80a8d
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions src/librustdoc/visit_ast.rs
Expand Up @@ -66,12 +66,8 @@ impl<'a, 'tcx> RustdocVisitor<'a, 'tcx> {
}

fn store_path(&mut self, did: DefId) {
// We can't use the entry API, as that keeps the mutable borrow of `self` active
// when we try to use `cx`.
if self.exact_paths.get(&did).is_none() {
let path = def_id_to_path(self.cx.tcx, did);
self.exact_paths.insert(did, path);
}
let tcx = self.cx.tcx;
self.exact_paths.entry(did).or_insert_with(|| def_id_to_path(tcx, did));
}

pub fn visit(mut self, krate: &'tcx hir::Crate) -> Module<'tcx> {
Expand Down

0 comments on commit 8f80a8d

Please sign in to comment.