@@ -50,7 +50,7 @@ impl fmt::Display for FlycheckConfig {
5050#[ derive( Debug ) ]
5151pub struct FlycheckHandle {
5252 // XXX: drop order is significant
53- cmd_send : Sender < Restart > ,
53+ sender : Sender < Restart > ,
5454 thread : jod_thread:: JoinHandle ,
5555}
5656
@@ -60,16 +60,15 @@ impl FlycheckHandle {
6060 config : FlycheckConfig ,
6161 workspace_root : PathBuf ,
6262 ) -> FlycheckHandle {
63- let ( cmd_send, cmd_recv) = unbounded :: < Restart > ( ) ;
64- let thread = jod_thread:: spawn ( move || {
65- FlycheckActor :: new ( sender, config, workspace_root) . run ( cmd_recv) ;
66- } ) ;
67- FlycheckHandle { cmd_send, thread }
63+ let actor = FlycheckActor :: new ( sender, config, workspace_root) ;
64+ let ( sender, receiver) = unbounded :: < Restart > ( ) ;
65+ let thread = jod_thread:: spawn ( move || actor. run ( receiver) ) ;
66+ FlycheckHandle { sender, thread }
6867 }
6968
7069 /// Schedule a re-start of the cargo check worker.
7170 pub fn update ( & self ) {
72- self . cmd_send . send ( Restart ) . unwrap ( ) ;
71+ self . sender . send ( Restart ) . unwrap ( ) ;
7372 }
7473}
7574
@@ -125,7 +124,7 @@ impl FlycheckActor {
125124 recv( check_chan. unwrap_or( & never( ) ) ) -> msg => Some ( Event :: CheckEvent ( msg. ok( ) ) ) ,
126125 }
127126 }
128- fn run ( & mut self , inbox : Receiver < Restart > ) {
127+ fn run ( mut self , inbox : Receiver < Restart > ) {
129128 while let Some ( event) = self . next_event ( & inbox) {
130129 match event {
131130 Event :: Restart ( Restart ) => {
0 commit comments