Skip to content

Commit 4c41c8d

Browse files
author
Marc Jakobi
committed
fix(runnables): don't apply nextest args to non-test targets
1 parent e54f51b commit 4c41c8d

File tree

2 files changed

+8
-9
lines changed

2 files changed

+8
-9
lines changed

lua/rustaceanvim/overrides.lua

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -55,17 +55,16 @@ local function partition_executable_args(arg_list)
5555
return before, after
5656
end
5757

58-
---Transforms the args to cargo-nextest args if it is detected.
59-
---Mutates command!
58+
---Transforms test args to cargo-nextest args if it is detected.
6059
---@param args string[]
61-
function M.try_nextest_transform(args)
62-
if vim.fn.executable('cargo-nextest') ~= 1 then
60+
---@return string[] args
61+
function M.maybe_nextest_transform(args)
62+
if vim.fn.executable('cargo-nextest') ~= 1 or args[1] ~= 'test' then
6363
return args
6464
end
65-
if args[1] == 'test' then
66-
args[1] = 'run'
67-
table.insert(args, 1, 'nextest')
68-
end
65+
args = vim.deepcopy(args)
66+
args[1] = 'run'
67+
table.insert(args, 1, 'nextest')
6968
local nextest_args, executable_args = partition_executable_args(args)
7069

7170
-- specify custom profile for junit output

lua/rustaceanvim/runnables.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ function M.get_command(runnable)
8686
and not config.tools.cargo_override
8787
and not vim.startswith(runnable.label, 'doctest')
8888
then
89-
ret = overrides.try_nextest_transform(ret)
89+
ret = overrides.maybe_nextest_transform(ret)
9090
end
9191

9292
return config.tools.cargo_override or 'cargo', ret, dir, env

0 commit comments

Comments
 (0)