Skip to content

Commit 3b5e51c

Browse files
authored
fix(enable_clippy): use correct rust-analyzer config key (#403)
1 parent b5d6ac5 commit 3b5e51c

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

lua/rustaceanvim/config/server.lua

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,21 @@ function server.load_rust_analyzer_settings(project_root, opts)
2222
local default_settings = opts.default_settings or config.server.default_settings
2323
local use_clippy = config.tools.enable_clippy and vim.fn.executable('cargo-clippy') == 1
2424
---@diagnostic disable-next-line: undefined-field
25-
if default_settings['rust-analyzer'].checkOnSave == nil and use_clippy then
25+
if
26+
default_settings['rust-analyzer'].check == nil
27+
and use_clippy
28+
and type(default_settings['rust-analyzer'].checkOnSave) ~= 'table'
29+
then
2630
---@diagnostic disable-next-line: inject-field
27-
default_settings['rust-analyzer'].checkOnSave = {
31+
default_settings['rust-analyzer'].check = {
2832
allFeatures = true,
2933
command = 'clippy',
3034
extraArgs = { '--no-deps' },
3135
}
36+
if type(default_settings['rust-analyzer'].checkOnSave) ~= 'boolean' then
37+
---@diagnostic disable-next-line: inject-field
38+
default_settings['rust-analyzer'].checkOnSave = true
39+
end
3240
end
3341
if not project_root then
3442
return default_settings

0 commit comments

Comments
 (0)