File tree 4 files changed +935
-930
lines changed
4 files changed +935
-930
lines changed Original file line number Diff line number Diff line change @@ -38,6 +38,7 @@ diagnostics![
38
38
MacroError ,
39
39
MismatchedArgCount ,
40
40
MissingFields ,
41
+ MissingMatchArms ,
41
42
MissingOkOrSomeInTailExpr ,
42
43
MissingUnsafe ,
43
44
NoSuchField ,
@@ -149,31 +150,13 @@ pub struct MissingOkOrSomeInTailExpr {
149
150
pub required : String ,
150
151
}
151
152
152
- // Diagnostic: missing-match-arm
153
- //
154
- // This diagnostic is triggered if `match` block is missing one or more match arms.
155
153
#[ derive( Debug ) ]
156
154
pub struct MissingMatchArms {
157
155
pub file : HirFileId ,
158
156
pub match_expr : AstPtr < ast:: Expr > ,
159
157
pub arms : AstPtr < ast:: MatchArmList > ,
160
158
}
161
159
162
- impl Diagnostic for MissingMatchArms {
163
- fn code ( & self ) -> DiagnosticCode {
164
- DiagnosticCode ( "missing-match-arm" )
165
- }
166
- fn message ( & self ) -> String {
167
- String :: from ( "Missing match arm" )
168
- }
169
- fn display_source ( & self ) -> InFile < SyntaxNodePtr > {
170
- InFile { file_id : self . file , value : self . match_expr . clone ( ) . into ( ) }
171
- }
172
- fn as_any ( & self ) -> & ( dyn Any + Send + ' static ) {
173
- self
174
- }
175
- }
176
-
177
160
#[ derive( Debug ) ]
178
161
pub struct InternalBailedOut {
179
162
pub file : HirFileId ,
Original file line number Diff line number Diff line change @@ -1209,11 +1209,14 @@ impl Function {
1209
1209
if let ( Some ( match_expr) , Some ( arms) ) =
1210
1210
( match_expr. expr ( ) , match_expr. match_arm_list ( ) )
1211
1211
{
1212
- sink. push ( MissingMatchArms {
1213
- file : source_ptr. file_id ,
1214
- match_expr : AstPtr :: new ( & match_expr) ,
1215
- arms : AstPtr :: new ( & arms) ,
1216
- } )
1212
+ acc. push (
1213
+ MissingMatchArms {
1214
+ file : source_ptr. file_id ,
1215
+ match_expr : AstPtr :: new ( & match_expr) ,
1216
+ arms : AstPtr :: new ( & arms) ,
1217
+ }
1218
+ . into ( ) ,
1219
+ )
1217
1220
}
1218
1221
}
1219
1222
}
You can’t perform that action at this time.
0 commit comments