@@ -472,16 +472,15 @@ fn format_type_name(raw_name: &str) -> String {
472
472
while index < end_of_string {
473
473
let rest_of_string = raw_name. get ( index..end_of_string) . unwrap_or_default ( ) ;
474
474
475
- // Collapse everything up to the next "<", "," or ">" ,
475
+ // Collapse everything up to the next special character ,
476
476
// then skip over it
477
477
if let Some ( special_character_index) =
478
- rest_of_string. find ( |c : char | ( c == '<' ) || ( c == ',' ) || ( c == '>' ) )
478
+ rest_of_string. find ( |c : char | ( c == '<' ) || ( c == ',' ) || ( c == ' ' ) || ( c == ' >') )
479
479
{
480
480
let segment_to_collapse = rest_of_string
481
481
. get ( 0 ..special_character_index)
482
482
. unwrap_or_default ( ) ;
483
- let collapsed_type_name = collapse_type_name ( segment_to_collapse) ;
484
- parsed_name += & collapsed_type_name;
483
+ parsed_name += collapse_type_name ( segment_to_collapse) ;
485
484
// Insert the special character
486
485
let special_character =
487
486
& rest_of_string[ special_character_index..=special_character_index] ;
@@ -490,8 +489,7 @@ fn format_type_name(raw_name: &str) -> String {
490
489
index += special_character_index + 1 ;
491
490
} else {
492
491
// If there are no special characters left, we're done!
493
- let collapsed_type_name = collapse_type_name ( rest_of_string) ;
494
- parsed_name += & collapsed_type_name;
492
+ parsed_name += collapse_type_name ( rest_of_string) ;
495
493
index = end_of_string;
496
494
}
497
495
}
@@ -500,15 +498,8 @@ fn format_type_name(raw_name: &str) -> String {
500
498
}
501
499
502
500
#[ inline( always) ]
503
- fn collapse_type_name ( string : & str ) -> String {
504
- let type_name = string. split ( "::" ) . last ( ) . unwrap ( ) ;
505
-
506
- // Account for leading white space
507
- if string. get ( 0 ..1 ) . unwrap_or_default ( ) == " " && type_name != string {
508
- format ! ( " {type_name}" )
509
- } else {
510
- type_name. to_string ( )
511
- }
501
+ fn collapse_type_name ( string : & str ) -> & str {
502
+ string. split ( "::" ) . last ( ) . unwrap ( )
512
503
}
513
504
514
505
#[ cfg( test) ]
0 commit comments