mirror of
https://github.com/neovim/neovim
synced 2025-07-16 09:11:51 +00:00
perf(validate): use lighter version
- Also fix `vim.validate()` for PUC Lua when showing errors for values that aren't string or number.
This commit is contained in:
committed by
Lewis Russell
parent
fa6ab0d909
commit
3f3e4837d5
@ -26,7 +26,7 @@ end
|
||||
---
|
||||
---@param trust table<string, string> 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
|
||||
|
Reference in New Issue
Block a user