mirror of
https://github.com/folke/lazy.nvim.git
synced 2025-06-28 03:24:13 +00:00
Removed redundant equality check for performance
A valid local import spec never has `spec.import == M.LOCAL_SPEC` because by the time we do the check, we know that `find_local_spec()` succeeded (if it didn't, the spec:cond() check would have failed). Thus we only need to check if the modname ends with `'/' .. M.LOCAL_SPEC`.
This commit is contained in:
parent
151d7068b3
commit
52b9524548
1 changed files with 2 additions and 2 deletions
|
@ -405,7 +405,7 @@ function Spec:import(spec)
|
|||
|
||||
-- relies on `find_local_spec` to always insert a `/` before the local spec location
|
||||
local local_spec_suffix = "/" .. M.LOCAL_SPEC
|
||||
if spec.import == M.LOCAL_SPEC or spec.import:sub(-#local_spec_suffix) == local_spec_suffix then
|
||||
if spec.import:sub(-#local_spec_suffix) == local_spec_suffix then
|
||||
modnames = { spec.import }
|
||||
else
|
||||
Util.lsmod(spec.import, function(modname)
|
||||
|
@ -418,7 +418,7 @@ function Spec:import(spec)
|
|||
imported = imported + 1
|
||||
local name = modname
|
||||
local is_local_spec = false
|
||||
if modname == M.LOCAL_SPEC or modname:sub(-#local_spec_suffix) == local_spec_suffix then
|
||||
if modname:sub(-#local_spec_suffix) == local_spec_suffix then
|
||||
name = vim.fn.fnamemodify(modname, ":~:.")
|
||||
is_local_spec = true
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue