@@ -565,7 +565,7 @@ impl SuggestionKind {
565565
566566/// Types of subdiagnostics that can be created using attributes
567567#[ derive( Clone ) ]
568- pub ( super ) enum SubdiagnosticKind {
568+ pub ( super ) enum SubdiagKind {
569569 /// `#[label(...)]`
570570 Label ,
571571 /// `#[note(...)]`
@@ -593,15 +593,15 @@ pub(super) enum SubdiagnosticKind {
593593}
594594
595595pub ( super ) struct SubdiagnosticVariant {
596- pub ( super ) kind : SubdiagnosticKind ,
596+ pub ( super ) kind : SubdiagKind ,
597597 pub ( super ) slug : Option < Path > ,
598598 pub ( super ) no_span : bool ,
599599}
600600
601601impl SubdiagnosticVariant {
602602 /// Constructs a `SubdiagnosticVariant` from a field or type attribute such as `#[note]`,
603603 /// `#[error(parser::add_paren, no_span)]` or `#[suggestion(code = "...")]`. Returns the
604- /// `SubdiagnosticKind ` and the diagnostic slug, if specified.
604+ /// `SubdiagKind ` and the diagnostic slug, if specified.
605605 pub ( super ) fn from_attr (
606606 attr : & Attribute ,
607607 fields : & impl HasFieldMap ,
@@ -617,10 +617,10 @@ impl SubdiagnosticVariant {
617617 let name = name. as_str ( ) ;
618618
619619 let mut kind = match name {
620- "label" => SubdiagnosticKind :: Label ,
621- "note" => SubdiagnosticKind :: Note ,
622- "help" => SubdiagnosticKind :: Help ,
623- "warning" => SubdiagnosticKind :: Warn ,
620+ "label" => SubdiagKind :: Label ,
621+ "note" => SubdiagKind :: Note ,
622+ "help" => SubdiagKind :: Help ,
623+ "warning" => SubdiagKind :: Warn ,
624624 _ => {
625625 // Recover old `#[(multipart_)suggestion_*]` syntaxes
626626 // FIXME(#100717): remove
@@ -635,7 +635,7 @@ impl SubdiagnosticVariant {
635635 . emit ( ) ;
636636 }
637637
638- SubdiagnosticKind :: Suggestion {
638+ SubdiagKind :: Suggestion {
639639 suggestion_kind : SuggestionKind :: Normal ,
640640 applicability : None ,
641641 code_field : new_code_ident ( ) ,
@@ -652,7 +652,7 @@ impl SubdiagnosticVariant {
652652 . emit ( ) ;
653653 }
654654
655- SubdiagnosticKind :: MultipartSuggestion {
655+ SubdiagKind :: MultipartSuggestion {
656656 suggestion_kind : SuggestionKind :: Normal ,
657657 applicability : None ,
658658 }
@@ -675,14 +675,14 @@ impl SubdiagnosticVariant {
675675 // Only allow this if there are no mandatory properties, such as `code = "..."` in
676676 // `#[suggestion(...)]`
677677 match kind {
678- SubdiagnosticKind :: Label
679- | SubdiagnosticKind :: Note
680- | SubdiagnosticKind :: Help
681- | SubdiagnosticKind :: Warn
682- | SubdiagnosticKind :: MultipartSuggestion { .. } => {
678+ SubdiagKind :: Label
679+ | SubdiagKind :: Note
680+ | SubdiagKind :: Help
681+ | SubdiagKind :: Warn
682+ | SubdiagKind :: MultipartSuggestion { .. } => {
683683 return Ok ( Some ( SubdiagnosticVariant { kind, slug : None , no_span : false } ) ) ;
684684 }
685- SubdiagnosticKind :: Suggestion { .. } => {
685+ SubdiagKind :: Suggestion { .. } => {
686686 throw_span_err ! ( span, "suggestion without `code = \" ...\" `" )
687687 }
688688 }
@@ -735,7 +735,7 @@ impl SubdiagnosticVariant {
735735 let input = nested. input ;
736736
737737 match ( nested_name, & mut kind) {
738- ( "code" , SubdiagnosticKind :: Suggestion { code_field, .. } ) => {
738+ ( "code" , SubdiagKind :: Suggestion { code_field, .. } ) => {
739739 let code_init = build_suggestion_code (
740740 code_field,
741741 nested,
@@ -746,8 +746,8 @@ impl SubdiagnosticVariant {
746746 }
747747 (
748748 "applicability" ,
749- SubdiagnosticKind :: Suggestion { ref mut applicability, .. }
750- | SubdiagnosticKind :: MultipartSuggestion { ref mut applicability, .. } ,
749+ SubdiagKind :: Suggestion { ref mut applicability, .. }
750+ | SubdiagKind :: MultipartSuggestion { ref mut applicability, .. } ,
751751 ) => {
752752 let value = get_string ! ( ) ;
753753 let value = Applicability :: from_str ( & value. value ( ) ) . unwrap_or_else ( |( ) | {
@@ -759,8 +759,8 @@ impl SubdiagnosticVariant {
759759 }
760760 (
761761 "style" ,
762- SubdiagnosticKind :: Suggestion { .. }
763- | SubdiagnosticKind :: MultipartSuggestion { .. } ,
762+ SubdiagKind :: Suggestion { .. }
763+ | SubdiagKind :: MultipartSuggestion { .. } ,
764764 ) => {
765765 let value = get_string ! ( ) ;
766766
@@ -776,15 +776,15 @@ impl SubdiagnosticVariant {
776776 }
777777
778778 // Invalid nested attribute
779- ( _, SubdiagnosticKind :: Suggestion { .. } ) => {
779+ ( _, SubdiagKind :: Suggestion { .. } ) => {
780780 span_err ( path_span, "invalid nested attribute" )
781781 . help (
782782 "only `no_span`, `style`, `code` and `applicability` are valid nested attributes" ,
783783 )
784784 . emit ( ) ;
785785 has_errors = true ;
786786 }
787- ( _, SubdiagnosticKind :: MultipartSuggestion { .. } ) => {
787+ ( _, SubdiagKind :: MultipartSuggestion { .. } ) => {
788788 span_err ( path_span, "invalid nested attribute" )
789789 . help ( "only `no_span`, `style` and `applicability` are valid nested attributes" )
790790 . emit ( ) ;
@@ -805,7 +805,7 @@ impl SubdiagnosticVariant {
805805 } ) ?;
806806
807807 match kind {
808- SubdiagnosticKind :: Suggestion {
808+ SubdiagKind :: Suggestion {
809809 ref code_field,
810810 ref mut code_init,
811811 suggestion_kind : ref mut kind_field,
@@ -822,32 +822,27 @@ impl SubdiagnosticVariant {
822822 quote ! { let #code_field = std:: iter:: empty( ) ; }
823823 } ;
824824 }
825- SubdiagnosticKind :: MultipartSuggestion {
826- suggestion_kind : ref mut kind_field, ..
827- } => {
825+ SubdiagKind :: MultipartSuggestion { suggestion_kind : ref mut kind_field, .. } => {
828826 if let Some ( kind) = suggestion_kind. value ( ) {
829827 * kind_field = kind;
830828 }
831829 }
832- SubdiagnosticKind :: Label
833- | SubdiagnosticKind :: Note
834- | SubdiagnosticKind :: Help
835- | SubdiagnosticKind :: Warn => { }
830+ SubdiagKind :: Label | SubdiagKind :: Note | SubdiagKind :: Help | SubdiagKind :: Warn => { }
836831 }
837832
838833 Ok ( Some ( SubdiagnosticVariant { kind, slug, no_span } ) )
839834 }
840835}
841836
842- impl quote:: IdentFragment for SubdiagnosticKind {
837+ impl quote:: IdentFragment for SubdiagKind {
843838 fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
844839 match self {
845- SubdiagnosticKind :: Label => write ! ( f, "label" ) ,
846- SubdiagnosticKind :: Note => write ! ( f, "note" ) ,
847- SubdiagnosticKind :: Help => write ! ( f, "help" ) ,
848- SubdiagnosticKind :: Warn => write ! ( f, "warn" ) ,
849- SubdiagnosticKind :: Suggestion { .. } => write ! ( f, "suggestions_with_style" ) ,
850- SubdiagnosticKind :: MultipartSuggestion { .. } => {
840+ SubdiagKind :: Label => write ! ( f, "label" ) ,
841+ SubdiagKind :: Note => write ! ( f, "note" ) ,
842+ SubdiagKind :: Help => write ! ( f, "help" ) ,
843+ SubdiagKind :: Warn => write ! ( f, "warn" ) ,
844+ SubdiagKind :: Suggestion { .. } => write ! ( f, "suggestions_with_style" ) ,
845+ SubdiagKind :: MultipartSuggestion { .. } => {
851846 write ! ( f, "multipart_suggestion_with_style" )
852847 }
853848 }
0 commit comments