mirror of
https://github.com/neovim/neovim.git
synced 2024-12-23 12:45:17 -07:00
fix(lua): return after assert returns assert message (#27064)
This commit is contained in:
parent
f5d59340a6
commit
5aa14e1231
@ -180,10 +180,8 @@ local all_namespaces = {}
|
||||
---@return vim.diagnostic.Severity?
|
||||
local function to_severity(severity)
|
||||
if type(severity) == 'string' then
|
||||
return assert(
|
||||
M.severity[string.upper(severity)],
|
||||
string.format('Invalid severity: %s', severity)
|
||||
)
|
||||
assert(M.severity[string.upper(severity)], string.format('Invalid severity: %s', severity))
|
||||
return M.severity[string.upper(severity)]
|
||||
end
|
||||
return severity
|
||||
end
|
||||
|
@ -77,7 +77,8 @@ function M.to_lpeg(pattern)
|
||||
})
|
||||
|
||||
local lpeg_pattern = p:match(pattern) --[[@as vim.lpeg.Pattern?]]
|
||||
return assert(lpeg_pattern, 'Invalid glob')
|
||||
assert(lpeg_pattern, 'Invalid glob')
|
||||
return lpeg_pattern
|
||||
end
|
||||
|
||||
return M
|
||||
|
@ -1123,10 +1123,8 @@ function M._test()
|
||||
'if "expected" is given, "actual" is also required'
|
||||
)
|
||||
if expected then
|
||||
return assert(
|
||||
cond,
|
||||
('expected %s, got: %s'):format(vim.inspect(expected), vim.inspect(actual))
|
||||
)
|
||||
assert(cond, ('expected %s, got: %s'):format(vim.inspect(expected), vim.inspect(actual)))
|
||||
return cond
|
||||
else
|
||||
return assert(cond)
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user