@@ -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_received : bool ,
236
237
}
237
238
238
239
#[ allow( clippy:: large_enum_variant) ]
@@ -263,6 +264,7 @@ impl FlycheckActor {
263
264
command_handle : None ,
264
265
command_receiver : None ,
265
266
diagnostics_cleared_for : Default :: default ( ) ,
267
+ diagnostics_received : false ,
266
268
}
267
269
}
268
270
@@ -339,16 +341,14 @@ impl FlycheckActor {
339
341
error
340
342
) ;
341
343
}
342
- if self . diagnostics_cleared_for . is_empty ( ) {
344
+ if ! self . diagnostics_received {
343
345
tracing:: trace!( flycheck_id = self . id, "clearing diagnostics" ) ;
344
346
// We finished without receiving any diagnostics.
345
347
// Clear everything for good measure
346
348
self . send ( FlycheckMessage :: ClearDiagnostics {
347
349
id : self . id ,
348
350
package_id : None ,
349
351
} ) ;
350
- } else {
351
- self . diagnostics_cleared_for . clear ( ) ;
352
352
}
353
353
354
354
self . report_progress ( Progress :: DidFinish ( res) ) ;
@@ -382,6 +382,7 @@ impl FlycheckActor {
382
382
package_id = package_id. as_ref( ) . map( |it| & it. repr) ,
383
383
"diagnostic received"
384
384
) ;
385
+ self . diagnostics_received = true ;
385
386
if let Some ( package_id) = & package_id {
386
387
if self . diagnostics_cleared_for . insert ( package_id. clone ( ) ) {
387
388
tracing:: trace!(
@@ -419,6 +420,7 @@ impl FlycheckActor {
419
420
self . command_receiver . take ( ) ;
420
421
self . report_progress ( Progress :: DidCancel ) ;
421
422
self . diagnostics_cleared_for . clear ( ) ;
423
+ self . diagnostics_received = false ;
422
424
}
423
425
}
424
426
0 commit comments