From 30dc027e3e825f3ca449c1d9f9ba5d4f7f85f744 Mon Sep 17 00:00:00 2001 From: Filip Tibell Date: Mon, 21 Aug 2023 09:57:55 -0500 Subject: [PATCH] Clean up interrupt listener --- src/lune/scheduler/mod.rs | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/lune/scheduler/mod.rs b/src/lune/scheduler/mod.rs index b011878..6f5030f 100644 --- a/src/lune/scheduler/mod.rs +++ b/src/lune/scheduler/mod.rs @@ -66,13 +66,11 @@ impl<'lua, 'fut> Scheduler<'lua, 'fut> { let state = this.state.clone(); lua.set_interrupt(move |_| { if let Some(id) = state.get_current_thread_id() { - match state.get_thread_error(id) { - Some(e) => Err(e), - None => Ok(LuaVmState::Continue), + if let Some(err) = state.get_thread_error(id) { + return Err(err); } - } else { - Ok(LuaVmState::Continue) } + Ok(LuaVmState::Continue) }); this