From 3d2f62ae59154b9b4033b42cec7683f2012b37e4 Mon Sep 17 00:00:00 2001 From: sxyazi Date: Sat, 30 Mar 2024 22:14:37 +0800 Subject: [PATCH] .. --- yazi-plugin/src/utils/sync.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) 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 }) })?, )?;