@@ -162,26 +162,31 @@ impl FlycheckActor {
162
162
cargo_handle. cancel ( ) ;
163
163
}
164
164
while let Ok ( Restart ) = inbox. recv_timeout ( Duration :: from_millis ( 50 ) ) { }
165
-
166
- self . cancel_check_process ( ) ;
165
+ self . progress ( Progress :: DidCancel ) ;
167
166
168
167
let command = self . check_command ( ) ;
169
- let command_f = format ! ( "{command:?}" ) ;
170
168
tracing:: debug!( ?command, "will restart flycheck" ) ;
171
169
match CargoHandle :: spawn ( command) {
172
170
Ok ( cargo_handle) => {
173
- tracing:: debug!( %command_f, "did restart flycheck" ) ;
171
+ tracing:: debug!(
172
+ command = ?self . check_command( ) ,
173
+ "did restart flycheck"
174
+ ) ;
174
175
self . cargo_handle = Some ( cargo_handle) ;
175
176
self . progress ( Progress :: DidStart ) ;
176
177
}
177
178
Err ( error) => {
178
- tracing:: error!( %command_f, %error, "failed to restart flycheck" ) ;
179
+ tracing:: error!(
180
+ command = ?self . check_command( ) ,
181
+ %error, "failed to restart flycheck"
182
+ ) ;
179
183
}
180
184
}
181
185
}
182
186
Event :: CheckEvent ( None ) => {
183
- // Watcher finished, replace it with a never channel to
184
- // avoid busy-waiting.
187
+ tracing:: debug!( "flycheck finished" ) ;
188
+
189
+ // Watcher finished
185
190
let cargo_handle = self . cargo_handle . take ( ) . unwrap ( ) ;
186
191
let res = cargo_handle. join ( ) ;
187
192
if res. is_err ( ) {
@@ -209,8 +214,10 @@ impl FlycheckActor {
209
214
// If we rerun the thread, we need to discard the previous check results first
210
215
self . cancel_check_process ( ) ;
211
216
}
217
+
212
218
fn cancel_check_process ( & mut self ) {
213
- if self . cargo_handle . take ( ) . is_some ( ) {
219
+ if let Some ( cargo_handle) = self . cargo_handle . take ( ) {
220
+ cargo_handle. cancel ( ) ;
214
221
self . progress ( Progress :: DidCancel ) ;
215
222
}
216
223
}
0 commit comments