@@ -233,6 +233,7 @@ struct FlycheckActor {
233
233
/// The receiver side of the channel mentioned above.
234
234
command_receiver : Option < Receiver < CargoCheckMessage > > ,
235
235
diagnostics_cleared_for : FxHashSet < Arc < PackageId > > ,
236
+ diagnostics_cleared_for_all : bool ,
236
237
diagnostics_received : bool ,
237
238
}
238
239
@@ -264,6 +265,7 @@ impl FlycheckActor {
264
265
command_handle : None ,
265
266
command_receiver : None ,
266
267
diagnostics_cleared_for : Default :: default ( ) ,
268
+ diagnostics_cleared_for_all : false ,
267
269
diagnostics_received : false ,
268
270
}
269
271
}
@@ -350,6 +352,7 @@ impl FlycheckActor {
350
352
package_id : None ,
351
353
} ) ;
352
354
}
355
+ self . clear_diagnostics_state ( ) ;
353
356
354
357
self . report_progress ( Progress :: DidFinish ( res) ) ;
355
358
}
@@ -395,6 +398,12 @@ impl FlycheckActor {
395
398
package_id : Some ( package_id. clone ( ) ) ,
396
399
} ) ;
397
400
}
401
+ } else if !self . diagnostics_cleared_for_all {
402
+ self . diagnostics_cleared_for_all = true ;
403
+ self . send ( FlycheckMessage :: ClearDiagnostics {
404
+ id : self . id ,
405
+ package_id : None ,
406
+ } ) ;
398
407
}
399
408
self . send ( FlycheckMessage :: AddDiagnostic {
400
409
id : self . id ,
@@ -420,7 +429,12 @@ impl FlycheckActor {
420
429
self . command_receiver . take ( ) ;
421
430
self . report_progress ( Progress :: DidCancel ) ;
422
431
}
432
+ self . clear_diagnostics_state ( ) ;
433
+ }
434
+
435
+ fn clear_diagnostics_state ( & mut self ) {
423
436
self . diagnostics_cleared_for . clear ( ) ;
437
+ self . diagnostics_cleared_for_all = false ;
424
438
self . diagnostics_received = false ;
425
439
}
426
440
0 commit comments