diff --git a/src/runtimes/ruby.rs b/src/runtimes/ruby.rs index d124c6a..9324f67 100644 --- a/src/runtimes/ruby.rs +++ b/src/runtimes/ruby.rs @@ -50,7 +50,7 @@ impl From for RubyScript { type RubyClosure = Box; struct RubyThread { - sender: Option>, + sender: crossbeam_channel::Sender, handle: Option>, } @@ -70,7 +70,7 @@ impl RubyThread { }); RubyThread { - sender: Some(sender), + sender, handle: Some(handle), } } @@ -78,8 +78,6 @@ impl RubyThread { fn execute(&self, f: Box T + Send>) -> T { let (return_sender, return_receiver) = crossbeam_channel::bounded(0); self.sender - .as_ref() - .unwrap() .send(Box::new(move |ruby| { return_sender.send(f(ruby)).unwrap(); })) @@ -90,7 +88,6 @@ impl RubyThread { impl Drop for RubyThread { fn drop(&mut self) { - drop(self.sender.take().unwrap()); let handle = self.handle.take().unwrap(); handle.join().unwrap(); }