Skip to content

Commit 739e253

Browse files
committed
Merge "Structs", "Enums", etc. sections into new "Types" section
See #92656.
1 parent feea50e commit 739e253

File tree

2 files changed

+13
-26
lines changed

2 files changed

+13
-26
lines changed

src/librustdoc/html/render/mod.rs

+7-20
Original file line numberDiff line numberDiff line change
@@ -2416,14 +2416,11 @@ enum ItemSection {
24162416
PrimitiveTypes,
24172417
Modules,
24182418
Macros,
2419-
Structs,
2420-
Enums,
2419+
Types,
24212420
Constants,
24222421
Statics,
24232422
Traits,
24242423
Functions,
2425-
TypeDefinitions,
2426-
Unions,
24272424
Implementations,
24282425
TypeMethods,
24292426
Methods,
@@ -2448,14 +2445,11 @@ impl ItemSection {
24482445
PrimitiveTypes,
24492446
Modules,
24502447
Macros,
2451-
Structs,
2452-
Enums,
2448+
Types,
24532449
Constants,
24542450
Statics,
24552451
Traits,
24562452
Functions,
2457-
TypeDefinitions,
2458-
Unions,
24592453
Implementations,
24602454
TypeMethods,
24612455
Methods,
@@ -2476,11 +2470,8 @@ impl ItemSection {
24762470
match self {
24772471
Self::Reexports => "reexports",
24782472
Self::Modules => "modules",
2479-
Self::Structs => "structs",
2480-
Self::Unions => "unions",
2481-
Self::Enums => "enums",
2473+
Self::Types => "types",
24822474
Self::Functions => "functions",
2483-
Self::TypeDefinitions => "types",
24842475
Self::Statics => "statics",
24852476
Self::Constants => "constants",
24862477
Self::Traits => "traits",
@@ -2506,11 +2497,8 @@ impl ItemSection {
25062497
match self {
25072498
Self::Reexports => "Re-exports",
25082499
Self::Modules => "Modules",
2509-
Self::Structs => "Structs",
2510-
Self::Unions => "Unions",
2511-
Self::Enums => "Enums",
2500+
Self::Types => "Types",
25122501
Self::Functions => "Functions",
2513-
Self::TypeDefinitions => "Type Definitions",
25142502
Self::Statics => "Statics",
25152503
Self::Constants => "Constants",
25162504
Self::Traits => "Traits",
@@ -2536,12 +2524,11 @@ impl ItemSection {
25362524
fn item_ty_to_section(ty: ItemType) -> ItemSection {
25372525
match ty {
25382526
ItemType::ExternCrate | ItemType::Import => ItemSection::Reexports,
2527+
ItemType::Struct | ItemType::Enum | ItemType::Union | ItemType::Typedef => {
2528+
ItemSection::Types
2529+
}
25392530
ItemType::Module => ItemSection::Modules,
2540-
ItemType::Struct => ItemSection::Structs,
2541-
ItemType::Union => ItemSection::Unions,
2542-
ItemType::Enum => ItemSection::Enums,
25432531
ItemType::Function => ItemSection::Functions,
2544-
ItemType::Typedef => ItemSection::TypeDefinitions,
25452532
ItemType::Static => ItemSection::Statics,
25462533
ItemType::Constant => ItemSection::Constants,
25472534
ItemType::Trait => ItemSection::Traits,

src/librustdoc/html/render/print_item.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -208,12 +208,12 @@ fn item_module(w: &mut Buffer, cx: &Context<'_>, item: &clean::Item, items: &[cl
208208
ItemType::Macro => 4,
209209
ItemType::Struct => 5,
210210
ItemType::Enum => 6,
211-
ItemType::Constant => 7,
212-
ItemType::Static => 8,
213-
ItemType::Trait => 9,
214-
ItemType::Function => 10,
215-
ItemType::Typedef => 12,
216-
ItemType::Union => 13,
211+
ItemType::Typedef => 7,
212+
ItemType::Union => 8,
213+
ItemType::Constant => 9,
214+
ItemType::Static => 10,
215+
ItemType::Trait => 11,
216+
ItemType::Function => 12,
217217
_ => 14 + ty as u8,
218218
}
219219
}

0 commit comments

Comments
 (0)