Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 1 addition & 6 deletions src/librustdoc/clean/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -218,11 +218,6 @@ impl Clean<ExternalCrate> for CrateNum {

impl Clean<Item> for doctree::Module<'_> {
fn clean(&self, cx: &DocContext<'_>) -> Item {
// maintain a stack of mod ids, for doc comment path resolution
// but we also need to resolve the module's own docs based on whether its docs were written
// inside or outside the module, so check for that
let attrs = self.attrs.clean(cx);

let mut items: Vec<Item> = vec![];
items.extend(self.imports.iter().flat_map(|x| x.clean(cx)));
items.extend(self.foreigns.iter().map(|x| x.clean(cx)));
Expand Down Expand Up @@ -251,7 +246,7 @@ impl Clean<Item> for doctree::Module<'_> {
ModuleItem(Module { is_crate: self.is_crate, items }),
cx,
);
Item { attrs, source: span.clean(cx), ..what_rustc_thinks }
Item { source: span.clean(cx), ..what_rustc_thinks }
}
}

Expand Down
4 changes: 1 addition & 3 deletions src/librustdoc/doctree.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ use rustc_hir as hir;

crate struct Module<'hir> {
crate name: Option<Symbol>,
crate attrs: &'hir [ast::Attribute],
crate where_outer: Span,
crate where_inner: Span,
crate imports: Vec<Import<'hir>>,
Expand All @@ -23,13 +22,12 @@ crate struct Module<'hir> {
}

impl Module<'hir> {
crate fn new(name: Option<Symbol>, attrs: &'hir [ast::Attribute]) -> Module<'hir> {
crate fn new(name: Option<Symbol>) -> Module<'hir> {
Module {
name,
id: hir::CRATE_HIR_ID,
where_outer: rustc_span::DUMMY_SP,
where_inner: rustc_span::DUMMY_SP,
attrs,
imports: Vec::new(),
mods: Vec::new(),
items: Vec::new(),
Expand Down
6 changes: 1 addition & 5 deletions src/librustdoc/visit_ast.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
//! The Rust AST Visitor. Extracts useful information and massages it into a form
//! usable for `clean`.

use rustc_ast as ast;
use rustc_data_structures::fx::{FxHashMap, FxHashSet};
use rustc_hir as hir;
use rustc_hir::def::{DefKind, Res};
Expand Down Expand Up @@ -64,7 +63,6 @@ impl<'a, 'tcx> RustdocVisitor<'a, 'tcx> {
crate fn visit(mut self, krate: &'tcx hir::Crate<'_>) -> Module<'tcx> {
let mut module = self.visit_mod_contents(
krate.item.span,
krate.item.attrs,
&Spanned { span: rustc_span::DUMMY_SP, node: hir::VisibilityKind::Public },
hir::CRATE_HIR_ID,
&krate.item.module,
Expand All @@ -82,13 +80,12 @@ impl<'a, 'tcx> RustdocVisitor<'a, 'tcx> {
fn visit_mod_contents(
&mut self,
span: Span,
attrs: &'tcx [ast::Attribute],
vis: &'tcx hir::Visibility<'_>,
id: hir::HirId,
m: &'tcx hir::Mod<'tcx>,
name: Option<Symbol>,
) -> Module<'tcx> {
let mut om = Module::new(name, attrs);
let mut om = Module::new(name);
om.where_outer = span;
om.where_inner = m.inner;
om.id = id;
Expand Down Expand Up @@ -292,7 +289,6 @@ impl<'a, 'tcx> RustdocVisitor<'a, 'tcx> {
hir::ItemKind::Mod(ref m) => {
om.mods.push(self.visit_mod_contents(
item.span,
&item.attrs,
&item.vis,
item.hir_id,
m,
Expand Down