@@ -263,14 +263,22 @@ fn write_unit_table(ctx: &RenderContext<'_>, f: &mut impl Write) -> CargoResult<
263263
264264 let aggregated: Vec < AggregatedSections > = units. iter ( ) . map ( |u| aggregate_sections ( u) ) . collect ( ) ;
265265
266- let headers: Vec < _ > = if let Some ( sections) = aggregated. iter ( ) . find_map ( |s| match s {
267- AggregatedSections :: Sections ( sections) => Some ( sections) ,
268- _ => None ,
269- } ) {
270- sections. iter ( ) . map ( |s| s. 0 . clone ( ) ) . collect ( )
271- } else {
272- vec ! [ ]
273- } ;
266+ let headers: Vec < _ > = aggregated
267+ . iter ( )
268+ . find_map ( |s| match s {
269+ AggregatedSections :: Sections ( sections) => Some ( sections) ,
270+ _ => None ,
271+ } )
272+ . map ( |sections| {
273+ sections
274+ . iter ( )
275+ // We don't want to show the "Other" section in the table,
276+ // as it is usually a tiny portion out of the entire unit.
277+ . filter ( |( name, _) | matches ! ( name, SectionName :: Other ) )
278+ . map ( |s| s. 0 . clone ( ) )
279+ . collect ( )
280+ } )
281+ . unwrap_or_default ( ) ;
274282
275283 write ! (
276284 f,
@@ -375,29 +383,8 @@ fn to_unit_data(unit_times: &[UnitTime]) -> Vec<UnitData> {
375383 . iter ( )
376384 . filter_map ( |unit| unit_map. get ( unit) . copied ( ) )
377385 . collect ( ) ;
378- let aggregated = aggregate_sections ( ut) ;
379- let sections = match aggregated {
380- AggregatedSections :: Sections ( mut sections) => {
381- // We draw the sections in the pipeline graph in a way where the frontend
382- // section has the "default" build color, and then additional sections
383- // (codegen, link) are overlaid on top with a different color.
384- // However, there might be some time after the final (usually link) section,
385- // which definitely shouldn't be classified as "Frontend". We thus try to
386- // detect this situation and add a final "Other" section.
387- if let Some ( ( _, section) ) = sections. last ( )
388- && section. end < ut. duration
389- {
390- sections. push ( (
391- SectionName :: Other ,
392- SectionData {
393- start : section. end ,
394- end : ut. duration ,
395- } ,
396- ) ) ;
397- }
398-
399- Some ( sections)
400- }
386+ let sections = match aggregate_sections ( ut) {
387+ AggregatedSections :: Sections ( sections) => Some ( sections) ,
401388 AggregatedSections :: OnlyTotalDuration => None ,
402389 } ;
403390
@@ -435,7 +422,7 @@ fn aggregate_sections(unit_time: &UnitTime) -> AggregatedSections {
435422 // section, we need to iterate them and if an end is missing, we assign the end of
436423 // the section to the start of the following section.
437424
438- let sections = unit_time. sections . clone ( ) . into_iter ( ) . fold (
425+ let mut sections = unit_time. sections . clone ( ) . into_iter ( ) . fold (
439426 // The frontend section is currently implicit in rustc.
440427 // It is assumed to start at compilation start and end when codegen starts,
441428 // So we hard-code it here.
@@ -457,6 +444,24 @@ fn aggregate_sections(unit_time: &UnitTime) -> AggregatedSections {
457444 } ,
458445 ) ;
459446
447+ // We draw the sections in the pipeline graph in a way where the frontend
448+ // section has the "default" build color, and then additional sections
449+ // (codegen, link) are overlaid on top with a different color.
450+ // However, there might be some time after the final (usually link) section,
451+ // which definitely shouldn't be classified as "Frontend". We thus try to
452+ // detect this situation and add a final "Other" section.
453+ if let Some ( ( _, section) ) = sections. last ( )
454+ && section. end < end
455+ {
456+ sections. push ( (
457+ SectionName :: Other ,
458+ SectionData {
459+ start : section. end ,
460+ end,
461+ } ,
462+ ) ) ;
463+ }
464+
460465 AggregatedSections :: Sections ( sections)
461466 } else if let Some ( rmeta) = unit_time. rmeta_time {
462467 // We only know when the rmeta time was generated
0 commit comments