33use std:: any:: Any ;
44
55use hir_expand:: { db:: AstDatabase , name:: Name , HirFileId , InFile } ;
6- use ra_syntax:: { ast, AstNode , AstPtr , SyntaxNodePtr , TextRange } ;
6+ use ra_syntax:: { ast, AstNode , AstPtr , SyntaxNodePtr } ;
77use stdx:: format_to;
88
99pub use hir_def:: { diagnostics:: UnresolvedModule , expr:: MatchArm } ;
@@ -13,18 +13,13 @@ pub use hir_expand::diagnostics::{AstDiagnostic, Diagnostic, DiagnosticSink};
1313pub struct NoSuchField {
1414 pub file : HirFileId ,
1515 pub field : AstPtr < ast:: RecordField > ,
16- pub highlight_range : TextRange ,
1716}
1817
1918impl Diagnostic for NoSuchField {
2019 fn message ( & self ) -> String {
2120 "no such field" . to_string ( )
2221 }
2322
24- fn highlight_range ( & self ) -> InFile < TextRange > {
25- InFile :: new ( self . file , self . highlight_range )
26- }
27-
2823 fn source ( & self ) -> InFile < SyntaxNodePtr > {
2924 InFile :: new ( self . file , self . field . clone ( ) . into ( ) )
3025 }
@@ -38,7 +33,6 @@ impl Diagnostic for NoSuchField {
3833pub struct MissingFields {
3934 pub file : HirFileId ,
4035 pub field_list : AstPtr < ast:: RecordFieldList > ,
41- pub highlight_range : TextRange ,
4236 pub missed_fields : Vec < Name > ,
4337}
4438
@@ -50,10 +44,6 @@ impl Diagnostic for MissingFields {
5044 }
5145 buf
5246 }
53- fn highlight_range ( & self ) -> InFile < TextRange > {
54- InFile :: new ( self . file , self . highlight_range )
55- }
56-
5747 fn source ( & self ) -> InFile < SyntaxNodePtr > {
5848 InFile { file_id : self . file , value : self . field_list . clone ( ) . into ( ) }
5949 }
@@ -76,7 +66,6 @@ impl AstDiagnostic for MissingFields {
7666pub struct MissingPatFields {
7767 pub file : HirFileId ,
7868 pub field_list : AstPtr < ast:: RecordFieldPatList > ,
79- pub highlight_range : TextRange ,
8069 pub missed_fields : Vec < Name > ,
8170}
8271
@@ -88,9 +77,6 @@ impl Diagnostic for MissingPatFields {
8877 }
8978 buf
9079 }
91- fn highlight_range ( & self ) -> InFile < TextRange > {
92- InFile :: new ( self . file , self . highlight_range )
93- }
9480 fn source ( & self ) -> InFile < SyntaxNodePtr > {
9581 InFile { file_id : self . file , value : self . field_list . clone ( ) . into ( ) }
9682 }
@@ -104,16 +90,12 @@ pub struct MissingMatchArms {
10490 pub file : HirFileId ,
10591 pub match_expr : AstPtr < ast:: Expr > ,
10692 pub arms : AstPtr < ast:: MatchArmList > ,
107- pub highlight_range : TextRange ,
10893}
10994
11095impl Diagnostic for MissingMatchArms {
11196 fn message ( & self ) -> String {
11297 String :: from ( "Missing match arm" )
11398 }
114- fn highlight_range ( & self ) -> InFile < TextRange > {
115- InFile :: new ( self . file , self . highlight_range )
116- }
11799 fn source ( & self ) -> InFile < SyntaxNodePtr > {
118100 InFile { file_id : self . file , value : self . match_expr . clone ( ) . into ( ) }
119101 }
@@ -126,16 +108,12 @@ impl Diagnostic for MissingMatchArms {
126108pub struct MissingOkInTailExpr {
127109 pub file : HirFileId ,
128110 pub expr : AstPtr < ast:: Expr > ,
129- pub highlight_range : TextRange ,
130111}
131112
132113impl Diagnostic for MissingOkInTailExpr {
133114 fn message ( & self ) -> String {
134115 "wrap return expression in Ok" . to_string ( )
135116 }
136- fn highlight_range ( & self ) -> InFile < TextRange > {
137- InFile :: new ( self . file , self . highlight_range )
138- }
139117 fn source ( & self ) -> InFile < SyntaxNodePtr > {
140118 InFile { file_id : self . file , value : self . expr . clone ( ) . into ( ) }
141119 }
0 commit comments