Remove path prefixes from NodeKind

This commit is contained in:
varkor 2018-08-22 23:05:26 +01:00
parent 4b12f700db
commit 11665ca45a
38 changed files with 186 additions and 164 deletions

View file

@ -18,7 +18,7 @@ use syntax::attr;
use syntax::source_map::Spanned;
use syntax_pos::{self, Span};
use rustc::hir::map as hir_map;
use rustc::hir::map::NodeKind;
use rustc::hir::def::Def;
use rustc::hir::def_id::{DefId, LOCAL_CRATE};
use rustc::middle::privacy::AccessLevel;
@ -295,7 +295,7 @@ impl<'a, 'tcx, 'rcx, 'cstore> RustdocVisitor<'a, 'tcx, 'rcx, 'cstore> {
if !self.view_item_stack.insert(def_node_id) { return false }
let ret = match tcx.hir.get(def_node_id) {
hir_map::NodeKind::Item(&hir::Item { node: hir::ItemKind::Mod(ref m), .. }) if glob => {
NodeKind::Item(&hir::Item { node: hir::ItemKind::Mod(ref m), .. }) if glob => {
let prev = mem::replace(&mut self.inlining, true);
for i in &m.item_ids {
let i = self.cx.tcx.hir.expect_item(i.id);
@ -304,13 +304,13 @@ impl<'a, 'tcx, 'rcx, 'cstore> RustdocVisitor<'a, 'tcx, 'rcx, 'cstore> {
self.inlining = prev;
true
}
hir_map::NodeKind::Item(it) if !glob => {
NodeKind::Item(it) if !glob => {
let prev = mem::replace(&mut self.inlining, true);
self.visit_item(it, renamed, om);
self.inlining = prev;
true
}
hir_map::NodeKind::ForeignItem(it) if !glob => {
NodeKind::ForeignItem(it) if !glob => {
// generate a fresh `extern {}` block if we want to inline a foreign item.
om.foreigns.push(hir::ForeignMod {
abi: tcx.hir.get_foreign_abi(it.id),