@@ -233,6 +233,7 @@ struct FlycheckActor {
233233 /// The receiver side of the channel mentioned above.
234234 command_receiver : Option < Receiver < CargoCheckMessage > > ,
235235 diagnostics_cleared_for : FxHashSet < Arc < PackageId > > ,
236+ diagnostics_received : bool ,
236237}
237238
238239#[ allow( clippy:: large_enum_variant) ]
@@ -263,6 +264,7 @@ impl FlycheckActor {
263264 command_handle : None ,
264265 command_receiver : None ,
265266 diagnostics_cleared_for : Default :: default ( ) ,
267+ diagnostics_received : false ,
266268 }
267269 }
268270
@@ -339,16 +341,14 @@ impl FlycheckActor {
339341 error
340342 ) ;
341343 }
342- if self . diagnostics_cleared_for . is_empty ( ) {
344+ if ! self . diagnostics_received {
343345 tracing:: trace!( flycheck_id = self . id, "clearing diagnostics" ) ;
344346 // We finished without receiving any diagnostics.
345347 // Clear everything for good measure
346348 self . send ( FlycheckMessage :: ClearDiagnostics {
347349 id : self . id ,
348350 package_id : None ,
349351 } ) ;
350- } else {
351- self . diagnostics_cleared_for . clear ( ) ;
352352 }
353353
354354 self . report_progress ( Progress :: DidFinish ( res) ) ;
@@ -382,6 +382,7 @@ impl FlycheckActor {
382382 package_id = package_id. as_ref( ) . map( |it| & it. repr) ,
383383 "diagnostic received"
384384 ) ;
385+ self . diagnostics_received = true ;
385386 if let Some ( package_id) = & package_id {
386387 if self . diagnostics_cleared_for . insert ( package_id. clone ( ) ) {
387388 tracing:: trace!(
@@ -419,6 +420,7 @@ impl FlycheckActor {
419420 self . command_receiver . take ( ) ;
420421 self . report_progress ( Progress :: DidCancel ) ;
421422 self . diagnostics_cleared_for . clear ( ) ;
423+ self . diagnostics_received = false ;
422424 }
423425 }
424426
0 commit comments