From 3f3e4837d5f7d2d9cb1c89bd3a5b2ee8a730772a Mon Sep 17 00:00:00 2001 From: Lewis Russell Date: Wed, 16 Oct 2024 17:03:48 +0100 Subject: perf(validate): use lighter version - Also fix `vim.validate()` for PUC Lua when showing errors for values that aren't string or number. --- runtime/lua/vim/secure.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'runtime/lua/vim/secure.lua') diff --git a/runtime/lua/vim/secure.lua b/runtime/lua/vim/secure.lua index 266725cce2..0d3a271ac7 100644 --- a/runtime/lua/vim/secure.lua +++ b/runtime/lua/vim/secure.lua @@ -26,7 +26,7 @@ end --- ---@param trust table Trust table to write local function write_trust(trust) - vim.validate({ trust = { trust, 't' } }) + vim.validate('trust', trust, 'table') local f = assert(io.open(vim.fn.stdpath('state') .. '/trust', 'w')) local t = {} ---@type string[] @@ -49,7 +49,7 @@ end ---@return (string|nil) The contents of the given file if it exists and is --- trusted, or nil otherwise. function M.read(path) - vim.validate({ path = { path, 's' } }) + vim.validate('path', path, 'string') local fullpath = vim.uv.fs_realpath(vim.fs.normalize(path)) if not fullpath then return nil -- cgit