From 1c804fc40b4c7274184be8ed065ababb218cfdcd Mon Sep 17 00:00:00 2001 From: Haled Odat <8566042+HalidOdat@users.noreply.github.com> Date: Fri, 11 Aug 2023 12:02:28 +0200 Subject: [PATCH] Apply review --- boa_engine/src/context/mod.rs | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/boa_engine/src/context/mod.rs b/boa_engine/src/context/mod.rs index 4f8ef59c9d5..96b9e06ddd0 100644 --- a/boa_engine/src/context/mod.rs +++ b/boa_engine/src/context/mod.rs @@ -717,13 +717,11 @@ impl Context<'_> { // 1. If the execution context stack is empty, return null. // 2. Let ec be the topmost execution context on the execution context stack whose ScriptOrModule component is not null. // 3. If no such execution context exists, return null. Otherwise, return ec's ScriptOrModule. - for frame in self.vm.frames.iter().rev() { - if frame.active_runnable.is_some() { - return frame.active_runnable.clone(); - } - } - - None + self.vm + .frames + .iter() + .rev() + .find_map(|frame| frame.active_runnable.clone()) } /// Get `active function object`