diff --git a/yazi-plugin/src/utils/sync.rs b/yazi-plugin/src/utils/sync.rs index 899c776c..55fd6b90 100644 --- a/yazi-plugin/src/utils/sync.rs +++ b/yazi-plugin/src/utils/sync.rs @@ -33,11 +33,11 @@ impl Utils { lua.create_function(|lua, ()| { let block = lua.named_registry_value::("rt")?.next_block(); lua.create_async_function(move |lua, args: Variadic| async move { - if let Some(cur) = lua.named_registry_value::("rt")?.current.clone() { - Self::retrieve(cur, block, args).await - } else { - Err("`ya.sync()` must be called in a plugin").into_lua_err() - } + let Some(cur) = lua.named_registry_value::("rt")?.current.clone() else { + return Err("`ya.sync()` must be called in a plugin").into_lua_err(); + }; + + Self::retrieve(cur, block, args).await }) })?, )?;