Skip to content

Commit a7f902b

Browse files
committed
Remove another unnecessary Option
The previous changes mean that we can now remove this `Option`.
1 parent 68244fc commit a7f902b

File tree

3 files changed

+7
-13
lines changed

3 files changed

+7
-13
lines changed

src/librustdoc/clean/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ impl Clean<Item> for doctree::Module<'_> {
231231

232232
let what_rustc_thinks = Item::from_hir_id_and_parts(
233233
self.id,
234-
self.name,
234+
Some(self.name),
235235
ModuleItem(Module { is_crate: self.is_crate, items }),
236236
cx,
237237
);

src/librustdoc/doctree.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use rustc_span::{self, Span, Symbol};
55
use rustc_hir as hir;
66

77
crate struct Module<'hir> {
8-
crate name: Option<Symbol>,
8+
crate name: Symbol,
99
crate where_outer: Span,
1010
crate where_inner: Span,
1111
crate mods: Vec<Module<'hir>>,
@@ -18,7 +18,7 @@ crate struct Module<'hir> {
1818
}
1919

2020
impl Module<'hir> {
21-
crate fn new(name: Option<Symbol>) -> Module<'hir> {
21+
crate fn new(name: Symbol) -> Module<'hir> {
2222
Module {
2323
name,
2424
id: hir::CRATE_HIR_ID,

src/librustdoc/visit_ast.rs

+4-10
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ impl<'a, 'tcx> RustdocVisitor<'a, 'tcx> {
7676
&Spanned { span: rustc_span::DUMMY_SP, node: hir::VisibilityKind::Public },
7777
hir::CRATE_HIR_ID,
7878
&krate.item.module,
79-
Some(self.cx.tcx.crate_name),
79+
self.cx.tcx.crate_name,
8080
);
8181
top_level_module.is_crate = true;
8282
// Attach the crate's exported macros to the top-level module.
@@ -114,7 +114,7 @@ impl<'a, 'tcx> RustdocVisitor<'a, 'tcx> {
114114
_ => continue 'exported_macros,
115115
};
116116
// Descend into the child module that matches this path segment (if any).
117-
match cur_mod.mods.iter_mut().find(|child| child.name == Some(path_segment_ty_ns)) {
117+
match cur_mod.mods.iter_mut().find(|child| child.name == path_segment_ty_ns) {
118118
Some(child_mod) => cur_mod = &mut *child_mod,
119119
None => continue 'exported_macros,
120120
}
@@ -133,7 +133,7 @@ impl<'a, 'tcx> RustdocVisitor<'a, 'tcx> {
133133
vis: &'tcx hir::Visibility<'_>,
134134
id: hir::HirId,
135135
m: &'tcx hir::Mod<'tcx>,
136-
name: Option<Symbol>,
136+
name: Symbol,
137137
) -> Module<'tcx> {
138138
let mut om = Module::new(name);
139139
om.where_outer = span;
@@ -312,13 +312,7 @@ impl<'a, 'tcx> RustdocVisitor<'a, 'tcx> {
312312
om.items.push((item, renamed))
313313
}
314314
hir::ItemKind::Mod(ref m) => {
315-
om.mods.push(self.visit_mod_contents(
316-
item.span,
317-
&item.vis,
318-
item.hir_id(),
319-
m,
320-
Some(name),
321-
));
315+
om.mods.push(self.visit_mod_contents(item.span, &item.vis, item.hir_id(), m, name));
322316
}
323317
hir::ItemKind::Fn(..)
324318
| hir::ItemKind::ExternCrate(..)

0 commit comments

Comments
 (0)