Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 8 additions & 9 deletions lua/plenary/async/control.lua
Original file line number Diff line number Diff line change
Expand Up @@ -59,15 +59,14 @@ Semaphore.__index = Semaphore
---@param initial_permits number: the number of permits that it can give out
---@return Semaphore
function Semaphore.new(initial_permits)
vim.validate {
initial_permits = {
initial_permits,
function(n)
return n > 0
end,
"number greater than 0",
},
}
vim.validate(
"initial_permits",
initial_permits,
function(n)
return n > 0
end,
"number greater than 0"
)

return setmetatable({ permits = initial_permits, handles = {} }, Semaphore)
end
Expand Down
17 changes: 8 additions & 9 deletions lua/plenary/async_lib/util.lua
Original file line number Diff line number Diff line change
Expand Up @@ -112,15 +112,14 @@ Semaphore.__index = Semaphore
---@param initial_permits number: the number of permits that it can give out
---@return Semaphore
function Semaphore.new(initial_permits)
vim.validate {
initial_permits = {
initial_permits,
function(n)
return n > 0
end,
"number greater than 0",
},
}
vim.validate(
"initial_permits",
initial_permits,
function(n)
return n > 0
end,
"number greater than 0"
)

return setmetatable({ permits = initial_permits, handles = {} }, Semaphore)
end
Expand Down
6 changes: 2 additions & 4 deletions lua/plenary/benchmark/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -93,10 +93,8 @@ end
---@param name string @benchmark name
---@param opts benchmark_run_opts
local bench = function(name, opts)
vim.validate {
opts = { opts, "table" },
fun = { opts.fun, "table" },
}
vim.validate("opts", opts, "table")
vim.validate("fun", opts.fun, "table")
opts.warmup = vim.F.if_nil(opts.warmup, 3)
opts.runs = vim.F.if_nil(opts.runs, 5)

Expand Down