@@ -649,14 +649,14 @@ pub enum DisplayAnnotationType {
649649 Help ,
650650}
651651
652- impl From < snippet:: AnnotationType > for DisplayAnnotationType {
653- fn from ( at : snippet:: AnnotationType ) -> Self {
652+ impl From < snippet:: Level > for DisplayAnnotationType {
653+ fn from ( at : snippet:: Level ) -> Self {
654654 match at {
655- snippet:: AnnotationType :: Error => DisplayAnnotationType :: Error ,
656- snippet:: AnnotationType :: Warning => DisplayAnnotationType :: Warning ,
657- snippet:: AnnotationType :: Info => DisplayAnnotationType :: Info ,
658- snippet:: AnnotationType :: Note => DisplayAnnotationType :: Note ,
659- snippet:: AnnotationType :: Help => DisplayAnnotationType :: Help ,
655+ snippet:: Level :: Error => DisplayAnnotationType :: Error ,
656+ snippet:: Level :: Warning => DisplayAnnotationType :: Warning ,
657+ snippet:: Level :: Info => DisplayAnnotationType :: Info ,
658+ snippet:: Level :: Note => DisplayAnnotationType :: Note ,
659+ snippet:: Level :: Help => DisplayAnnotationType :: Help ,
660660 }
661661 }
662662}
@@ -736,7 +736,7 @@ fn format_label(
736736fn format_title < ' a > ( title : snippet:: Label < ' a > , id : Option < & ' a str > ) -> DisplayLine < ' a > {
737737 DisplayLine :: Raw ( DisplayRawLine :: Annotation {
738738 annotation : Annotation {
739- annotation_type : DisplayAnnotationType :: from ( title. annotation_type ) ,
739+ annotation_type : DisplayAnnotationType :: from ( title. level ) ,
740740 id,
741741 label : format_label ( Some ( title. label ) , Some ( DisplayTextStyle :: Emphasis ) ) ,
742742 } ,
@@ -750,7 +750,7 @@ fn format_footer(footer: snippet::Label<'_>) -> Vec<DisplayLine<'_>> {
750750 for ( i, line) in footer. label . lines ( ) . enumerate ( ) {
751751 result. push ( DisplayLine :: Raw ( DisplayRawLine :: Annotation {
752752 annotation : Annotation {
753- annotation_type : DisplayAnnotationType :: from ( footer. annotation_type ) ,
753+ annotation_type : DisplayAnnotationType :: from ( footer. level ) ,
754754 id : None ,
755755 label : format_label ( Some ( line) , None ) ,
756756 } ,
@@ -1010,10 +1010,10 @@ fn format_body(
10101010 // It would be nice to use filter_drain here once it's stable.
10111011 annotations. retain ( |annotation| {
10121012 let body_idx = idx + annotation_line_count;
1013- let annotation_type = match annotation. annotation_type {
1014- snippet:: AnnotationType :: Error => DisplayAnnotationType :: None ,
1015- snippet:: AnnotationType :: Warning => DisplayAnnotationType :: None ,
1016- _ => DisplayAnnotationType :: from ( annotation. annotation_type ) ,
1013+ let annotation_type = match annotation. level {
1014+ snippet:: Level :: Error => DisplayAnnotationType :: None ,
1015+ snippet:: Level :: Warning => DisplayAnnotationType :: None ,
1016+ _ => DisplayAnnotationType :: from ( annotation. level ) ,
10171017 } ;
10181018 match annotation. range {
10191019 Range { start, .. } if start > line_end_index => true ,
@@ -1036,9 +1036,7 @@ fn format_body(
10361036 label : format_label ( Some ( annotation. label ) , None ) ,
10371037 } ,
10381038 range,
1039- annotation_type : DisplayAnnotationType :: from (
1040- annotation. annotation_type ,
1041- ) ,
1039+ annotation_type : DisplayAnnotationType :: from ( annotation. level ) ,
10421040 annotation_part : DisplayAnnotationPart :: Standalone ,
10431041 } ,
10441042 } ,
@@ -1059,9 +1057,7 @@ fn format_body(
10591057 {
10601058 inline_marks. push ( DisplayMark {
10611059 mark_type : DisplayMarkType :: AnnotationStart ,
1062- annotation_type : DisplayAnnotationType :: from (
1063- annotation. annotation_type ,
1064- ) ,
1060+ annotation_type : DisplayAnnotationType :: from ( annotation. level ) ,
10651061 } ) ;
10661062 }
10671063 } else {
@@ -1079,9 +1075,7 @@ fn format_body(
10791075 label : vec ! [ ] ,
10801076 } ,
10811077 range,
1082- annotation_type : DisplayAnnotationType :: from (
1083- annotation. annotation_type ,
1084- ) ,
1078+ annotation_type : DisplayAnnotationType :: from ( annotation. level ) ,
10851079 annotation_part : DisplayAnnotationPart :: MultilineStart ,
10861080 } ,
10871081 } ,
@@ -1098,9 +1092,7 @@ fn format_body(
10981092 {
10991093 inline_marks. push ( DisplayMark {
11001094 mark_type : DisplayMarkType :: AnnotationThrough ,
1101- annotation_type : DisplayAnnotationType :: from (
1102- annotation. annotation_type ,
1103- ) ,
1095+ annotation_type : DisplayAnnotationType :: from ( annotation. level ) ,
11041096 } ) ;
11051097 }
11061098 true
@@ -1117,9 +1109,7 @@ fn format_body(
11171109 {
11181110 inline_marks. push ( DisplayMark {
11191111 mark_type : DisplayMarkType :: AnnotationThrough ,
1120- annotation_type : DisplayAnnotationType :: from (
1121- annotation. annotation_type ,
1122- ) ,
1112+ annotation_type : DisplayAnnotationType :: from ( annotation. level ) ,
11231113 } ) ;
11241114 }
11251115
@@ -1131,9 +1121,7 @@ fn format_body(
11311121 lineno : None ,
11321122 inline_marks : vec ! [ DisplayMark {
11331123 mark_type: DisplayMarkType :: AnnotationThrough ,
1134- annotation_type: DisplayAnnotationType :: from(
1135- annotation. annotation_type,
1136- ) ,
1124+ annotation_type: DisplayAnnotationType :: from( annotation. level) ,
11371125 } ] ,
11381126 line : DisplaySourceLine :: Annotation {
11391127 annotation : Annotation {
@@ -1142,9 +1130,7 @@ fn format_body(
11421130 label : format_label ( Some ( annotation. label ) , None ) ,
11431131 } ,
11441132 range,
1145- annotation_type : DisplayAnnotationType :: from (
1146- annotation. annotation_type ,
1147- ) ,
1133+ annotation_type : DisplayAnnotationType :: from ( annotation. level ) ,
11481134 annotation_part : DisplayAnnotationPart :: MultilineEnd ,
11491135 } ,
11501136 } ,
0 commit comments