Skip to content

Commit

Permalink
Merge "Structs", "Enums", etc. sections into new "Types" section
Browse files Browse the repository at this point in the history
  • Loading branch information
camelid committed Jan 8, 2022
1 parent feea50e commit 739e253
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 26 deletions.
27 changes: 7 additions & 20 deletions src/librustdoc/html/render/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2416,14 +2416,11 @@ enum ItemSection {
PrimitiveTypes,
Modules,
Macros,
Structs,
Enums,
Types,
Constants,
Statics,
Traits,
Functions,
TypeDefinitions,
Unions,
Implementations,
TypeMethods,
Methods,
Expand All @@ -2448,14 +2445,11 @@ impl ItemSection {
PrimitiveTypes,
Modules,
Macros,
Structs,
Enums,
Types,
Constants,
Statics,
Traits,
Functions,
TypeDefinitions,
Unions,
Implementations,
TypeMethods,
Methods,
Expand All @@ -2476,11 +2470,8 @@ impl ItemSection {
match self {
Self::Reexports => "reexports",
Self::Modules => "modules",
Self::Structs => "structs",
Self::Unions => "unions",
Self::Enums => "enums",
Self::Types => "types",
Self::Functions => "functions",
Self::TypeDefinitions => "types",
Self::Statics => "statics",
Self::Constants => "constants",
Self::Traits => "traits",
Expand All @@ -2506,11 +2497,8 @@ impl ItemSection {
match self {
Self::Reexports => "Re-exports",
Self::Modules => "Modules",
Self::Structs => "Structs",
Self::Unions => "Unions",
Self::Enums => "Enums",
Self::Types => "Types",
Self::Functions => "Functions",
Self::TypeDefinitions => "Type Definitions",
Self::Statics => "Statics",
Self::Constants => "Constants",
Self::Traits => "Traits",
Expand All @@ -2536,12 +2524,11 @@ impl ItemSection {
fn item_ty_to_section(ty: ItemType) -> ItemSection {
match ty {
ItemType::ExternCrate | ItemType::Import => ItemSection::Reexports,
ItemType::Struct | ItemType::Enum | ItemType::Union | ItemType::Typedef => {
ItemSection::Types
}
ItemType::Module => ItemSection::Modules,
ItemType::Struct => ItemSection::Structs,
ItemType::Union => ItemSection::Unions,
ItemType::Enum => ItemSection::Enums,
ItemType::Function => ItemSection::Functions,
ItemType::Typedef => ItemSection::TypeDefinitions,
ItemType::Static => ItemSection::Statics,
ItemType::Constant => ItemSection::Constants,
ItemType::Trait => ItemSection::Traits,
Expand Down
12 changes: 6 additions & 6 deletions src/librustdoc/html/render/print_item.rs
Original file line number Diff line number Diff line change
Expand Up @@ -208,12 +208,12 @@ fn item_module(w: &mut Buffer, cx: &Context<'_>, item: &clean::Item, items: &[cl
ItemType::Macro => 4,
ItemType::Struct => 5,
ItemType::Enum => 6,
ItemType::Constant => 7,
ItemType::Static => 8,
ItemType::Trait => 9,
ItemType::Function => 10,
ItemType::Typedef => 12,
ItemType::Union => 13,
ItemType::Typedef => 7,
ItemType::Union => 8,
ItemType::Constant => 9,
ItemType::Static => 10,
ItemType::Trait => 11,
ItemType::Function => 12,
_ => 14 + ty as u8,
}
}
Expand Down

0 comments on commit 739e253

Please sign in to comment.