Skip to content

Commit

Permalink
Misc rustdoc changes
Browse files Browse the repository at this point in the history
  • Loading branch information
bjorn3 committed Jul 13, 2018
1 parent c0955a3 commit 55c11e3
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 16 deletions.
8 changes: 0 additions & 8 deletions src/librustdoc/clean/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4318,14 +4318,6 @@ where

// Start of code copied from rust-clippy

pub fn get_trait_def_id(tcx: &TyCtxt, path: &[&str], use_local: bool) -> Option<DefId> {
if use_local {
path_to_def_local(tcx, path)
} else {
path_to_def(tcx, path)
}
}

pub fn path_to_def_local(tcx: &TyCtxt, path: &[&str]) -> Option<DefId> {
let krate = tcx.hir.krate();
let mut items = krate.module.item_ids.clone();
Expand Down
6 changes: 3 additions & 3 deletions src/librustdoc/core.rs
Original file line number Diff line number Diff line change
Expand Up @@ -360,9 +360,9 @@ pub fn run_core(search_paths: SearchPaths,
};

let send_trait = if crate_name == Some("core".to_string()) {
clean::get_trait_def_id(&tcx, &["marker", "Send"], true)
clean::path_to_def_local(&tcx, &["marker", "Send"])
} else {
clean::get_trait_def_id(&tcx, &["core", "marker", "Send"], false)
clean::path_to_def(&tcx, &["core", "marker", "Send"])
};

let ctxt = DocContext {
Expand All @@ -387,7 +387,7 @@ pub fn run_core(search_paths: SearchPaths,
debug!("crate: {:?}", tcx.hir.krate());

let krate = {
let mut v = RustdocVisitor::new(&*cstore, &ctxt);
let mut v = RustdocVisitor::new(&ctxt);
v.visit(tcx.hir.krate());
v.clean(&ctxt)
};
Expand Down
6 changes: 1 addition & 5 deletions src/librustdoc/visit_ast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ use syntax_pos::{self, Span};
use rustc::hir::map as hir_map;
use rustc::hir::def::Def;
use rustc::hir::def_id::{DefId, LOCAL_CRATE};
use rustc::middle::cstore::CrateStore;
use rustc::middle::privacy::AccessLevel;
use rustc::util::nodemap::{FxHashSet, FxHashMap};

Expand All @@ -40,7 +39,6 @@ use doctree::*;
// framework from syntax?

pub struct RustdocVisitor<'a, 'tcx: 'a, 'rcx: 'a> {
pub cstore: &'a CrateStore,
pub module: Module,
pub attrs: hir::HirVec<ast::Attribute>,
pub cx: &'a core::DocContext<'a, 'tcx, 'rcx>,
Expand All @@ -52,8 +50,7 @@ pub struct RustdocVisitor<'a, 'tcx: 'a, 'rcx: 'a> {
}

impl<'a, 'tcx, 'rcx> RustdocVisitor<'a, 'tcx, 'rcx> {
pub fn new(cstore: &'a CrateStore,
cx: &'a core::DocContext<'a, 'tcx, 'rcx>) -> RustdocVisitor<'a, 'tcx, 'rcx> {
pub fn new(cx: &'a core::DocContext<'a, 'tcx, 'rcx>) -> RustdocVisitor<'a, 'tcx, 'rcx> {
// If the root is re-exported, terminate all recursion.
let mut stack = FxHashSet();
stack.insert(ast::CRATE_NODE_ID);
Expand All @@ -65,7 +62,6 @@ impl<'a, 'tcx, 'rcx> RustdocVisitor<'a, 'tcx, 'rcx> {
inlining: false,
inside_public_path: true,
exact_paths: Some(FxHashMap()),
cstore,
}
}

Expand Down

0 comments on commit 55c11e3

Please sign in to comment.