diff --git a/src/librustdoc/clean.rs b/src/librustdoc/clean.rs index e8854215c00..05f6db8cc45 100644 --- a/src/librustdoc/clean.rs +++ b/src/librustdoc/clean.rs @@ -1229,16 +1229,15 @@ fn resolve_type(path: Path, tpbs: Option >, core::NotTyped(_) => return Bool }; debug!("searching for {:?} in defmap", id); - let def_map = tycx.def_map.borrow(); - let d = match def_map.get().find(&id) { - Some(k) => k, + let d = match tycx.def_map.borrow().find(&id) { + Some(&k) => k, None => { debug!("could not find {:?} in defmap (`{}`)", id, tycx.map.node_to_str(id)); fail!("Unexpected failure: unresolved id not in defmap (this is a bug!)") } }; - let (def_id, kind) = match *d { + let (def_id, kind) = match d { ast::DefFn(i, _) => (i, TypeFunction), ast::DefSelfTy(i) => return Self(i), ast::DefTy(i) => (i, TypeEnum), @@ -1285,8 +1284,7 @@ fn resolve_def(id: ast::NodeId) -> Option { let cx = local_data::get(super::ctxtkey, |x| *x.unwrap()); match cx.maybe_typed { core::Typed(ref tcx) => { - let def_map = tcx.def_map.borrow(); - def_map.get().find(&id).map(|&d| ast_util::def_id_of_def(d)) + tcx.def_map.borrow().find(&id).map(|&d| ast_util::def_id_of_def(d)) } core::NotTyped(_) => None } diff --git a/src/librustdoc/visit_ast.rs b/src/librustdoc/visit_ast.rs index df533d882f7..8be3535b3ec 100644 --- a/src/librustdoc/visit_ast.rs +++ b/src/librustdoc/visit_ast.rs @@ -186,7 +186,7 @@ impl<'a> RustdocVisitor<'a> { core::Typed(ref tcx) => tcx, core::NotTyped(_) => return false }; - let def = ast_util::def_id_of_def(*tcx.def_map.borrow().get().get(&id)); + let def = ast_util::def_id_of_def(*tcx.def_map.borrow().get(&id)); if !ast_util::is_local(def) { return false } let analysis = match self.analysis { Some(analysis) => analysis, None => return false