Rollup merge of #36045 - ollie27:rustdoc_titles3, r=steveklabnik
rustdoc: Add missing item types to page titles Most pages include the item type in the title such as "Struct std::vec::Vec". However it is missing from the pages for foreign functions, type definitions, macros, statics and constants. This adds them so for example, instead of a title of "std::u32::MAX" it is "Constant std::u32::MAX" to match the others. [before](https://doc.rust-lang.org/nightly/std/u32/constant.MAX.html) [after](https://ollie27.github.io/rust_doc_test/std/u32/constant.MAX.html) [before](https://doc.rust-lang.org/nightly/std/io/type.Result.html) [after](https://ollie27.github.io/rust_doc_test/std/io/type.Result.html) Previous discussions: #34345, #35003
This commit is contained in:
@@ -1560,13 +1560,22 @@ impl<'a> fmt::Display for Item<'a> {
|
||||
} else {
|
||||
write!(fmt, "Module ")?;
|
||||
},
|
||||
clean::FunctionItem(..) => write!(fmt, "Function ")?,
|
||||
clean::FunctionItem(..) | clean::ForeignFunctionItem(..) =>
|
||||
write!(fmt, "Function ")?,
|
||||
clean::TraitItem(..) => write!(fmt, "Trait ")?,
|
||||
clean::StructItem(..) => write!(fmt, "Struct ")?,
|
||||
clean::UnionItem(..) => write!(fmt, "Union ")?,
|
||||
clean::EnumItem(..) => write!(fmt, "Enum ")?,
|
||||
clean::TypedefItem(..) => write!(fmt, "Type Definition ")?,
|
||||
clean::MacroItem(..) => write!(fmt, "Macro ")?,
|
||||
clean::PrimitiveItem(..) => write!(fmt, "Primitive Type ")?,
|
||||
_ => {}
|
||||
clean::StaticItem(..) | clean::ForeignStaticItem(..) =>
|
||||
write!(fmt, "Static ")?,
|
||||
clean::ConstantItem(..) => write!(fmt, "Constant ")?,
|
||||
_ => {
|
||||
// We don't generate pages for any other type.
|
||||
unreachable!();
|
||||
}
|
||||
}
|
||||
if !self.item.is_primitive() {
|
||||
let cur = &self.cx.current;
|
||||
@@ -1628,7 +1637,10 @@ impl<'a> fmt::Display for Item<'a> {
|
||||
clean::StaticItem(ref i) | clean::ForeignStaticItem(ref i) =>
|
||||
item_static(fmt, self.cx, self.item, i),
|
||||
clean::ConstantItem(ref c) => item_constant(fmt, self.cx, self.item, c),
|
||||
_ => Ok(())
|
||||
_ => {
|
||||
// We don't generate pages for any other type.
|
||||
unreachable!();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user