From: Dmitry Petrov Date: Wed, 5 Mar 2025 14:18:05 +0000 (-0500) Subject: Move an upvalue check out of the closure returned by gen_check_closure() X-Git-Tag: 3.11.1~5^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=804bd861a5c3b98f7bfea4d133365201e6252ef2;p=thirdparty%2Frspamd.git Move an upvalue check out of the closure returned by gen_check_closure() --- diff --git a/src/plugins/lua/settings.lua b/src/plugins/lua/settings.lua index 51622fb91d..0f8e007237 100644 --- a/src/plugins/lua/settings.lua +++ b/src/plugins/lua/settings.lua @@ -617,6 +617,12 @@ end -- Used to create a checking closure: if value matches expected somehow, return true local function gen_check_closure(expected, check_func) + if not check_func then + check_func = function(a, b) + return a == b + end + end + return function(value) if not value then return false @@ -627,13 +633,6 @@ local function gen_check_closure(expected, check_func) end if value then - - if not check_func then - check_func = function(a, b) - return a == b - end - end - local ret if type(expected) == 'table' then ret = fun.any(function(d)