From e92a3afe9f4520ac77f2e6e4901c9f25cb37a912 Mon Sep 17 00:00:00 2001 From: Jaroslaw Konik Date: Tue, 13 May 2025 18:11:49 +0200 Subject: [PATCH] no explicit drop --- src/runtimes/ruby.rs | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) 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(); }