mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-26 16:54:01 +00:00
Remove another unnecessary Option
The previous changes mean that we can now remove this `Option`.
This commit is contained in:
parent
68244fc521
commit
a7f902b693
@ -231,7 +231,7 @@ impl Clean<Item> for doctree::Module<'_> {
|
|||||||
|
|
||||||
let what_rustc_thinks = Item::from_hir_id_and_parts(
|
let what_rustc_thinks = Item::from_hir_id_and_parts(
|
||||||
self.id,
|
self.id,
|
||||||
self.name,
|
Some(self.name),
|
||||||
ModuleItem(Module { is_crate: self.is_crate, items }),
|
ModuleItem(Module { is_crate: self.is_crate, items }),
|
||||||
cx,
|
cx,
|
||||||
);
|
);
|
||||||
|
@ -5,7 +5,7 @@ use rustc_span::{self, Span, Symbol};
|
|||||||
use rustc_hir as hir;
|
use rustc_hir as hir;
|
||||||
|
|
||||||
crate struct Module<'hir> {
|
crate struct Module<'hir> {
|
||||||
crate name: Option<Symbol>,
|
crate name: Symbol,
|
||||||
crate where_outer: Span,
|
crate where_outer: Span,
|
||||||
crate where_inner: Span,
|
crate where_inner: Span,
|
||||||
crate mods: Vec<Module<'hir>>,
|
crate mods: Vec<Module<'hir>>,
|
||||||
@ -18,7 +18,7 @@ crate struct Module<'hir> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl Module<'hir> {
|
impl Module<'hir> {
|
||||||
crate fn new(name: Option<Symbol>) -> Module<'hir> {
|
crate fn new(name: Symbol) -> Module<'hir> {
|
||||||
Module {
|
Module {
|
||||||
name,
|
name,
|
||||||
id: hir::CRATE_HIR_ID,
|
id: hir::CRATE_HIR_ID,
|
||||||
|
@ -76,7 +76,7 @@ impl<'a, 'tcx> RustdocVisitor<'a, 'tcx> {
|
|||||||
&Spanned { span: rustc_span::DUMMY_SP, node: hir::VisibilityKind::Public },
|
&Spanned { span: rustc_span::DUMMY_SP, node: hir::VisibilityKind::Public },
|
||||||
hir::CRATE_HIR_ID,
|
hir::CRATE_HIR_ID,
|
||||||
&krate.item.module,
|
&krate.item.module,
|
||||||
Some(self.cx.tcx.crate_name),
|
self.cx.tcx.crate_name,
|
||||||
);
|
);
|
||||||
top_level_module.is_crate = true;
|
top_level_module.is_crate = true;
|
||||||
// Attach the crate's exported macros to the top-level module.
|
// Attach the crate's exported macros to the top-level module.
|
||||||
@ -114,7 +114,7 @@ impl<'a, 'tcx> RustdocVisitor<'a, 'tcx> {
|
|||||||
_ => continue 'exported_macros,
|
_ => continue 'exported_macros,
|
||||||
};
|
};
|
||||||
// Descend into the child module that matches this path segment (if any).
|
// Descend into the child module that matches this path segment (if any).
|
||||||
match cur_mod.mods.iter_mut().find(|child| child.name == Some(path_segment_ty_ns)) {
|
match cur_mod.mods.iter_mut().find(|child| child.name == path_segment_ty_ns) {
|
||||||
Some(child_mod) => cur_mod = &mut *child_mod,
|
Some(child_mod) => cur_mod = &mut *child_mod,
|
||||||
None => continue 'exported_macros,
|
None => continue 'exported_macros,
|
||||||
}
|
}
|
||||||
@ -133,7 +133,7 @@ impl<'a, 'tcx> RustdocVisitor<'a, 'tcx> {
|
|||||||
vis: &'tcx hir::Visibility<'_>,
|
vis: &'tcx hir::Visibility<'_>,
|
||||||
id: hir::HirId,
|
id: hir::HirId,
|
||||||
m: &'tcx hir::Mod<'tcx>,
|
m: &'tcx hir::Mod<'tcx>,
|
||||||
name: Option<Symbol>,
|
name: Symbol,
|
||||||
) -> Module<'tcx> {
|
) -> Module<'tcx> {
|
||||||
let mut om = Module::new(name);
|
let mut om = Module::new(name);
|
||||||
om.where_outer = span;
|
om.where_outer = span;
|
||||||
@ -312,13 +312,7 @@ impl<'a, 'tcx> RustdocVisitor<'a, 'tcx> {
|
|||||||
om.items.push((item, renamed))
|
om.items.push((item, renamed))
|
||||||
}
|
}
|
||||||
hir::ItemKind::Mod(ref m) => {
|
hir::ItemKind::Mod(ref m) => {
|
||||||
om.mods.push(self.visit_mod_contents(
|
om.mods.push(self.visit_mod_contents(item.span, &item.vis, item.hir_id(), m, name));
|
||||||
item.span,
|
|
||||||
&item.vis,
|
|
||||||
item.hir_id(),
|
|
||||||
m,
|
|
||||||
Some(name),
|
|
||||||
));
|
|
||||||
}
|
}
|
||||||
hir::ItemKind::Fn(..)
|
hir::ItemKind::Fn(..)
|
||||||
| hir::ItemKind::ExternCrate(..)
|
| hir::ItemKind::ExternCrate(..)
|
||||||
|
Loading…
Reference in New Issue
Block a user