Skip to content

Commit

Permalink
fix(enable_clippy): use correct rust-analyzer config key (#403)
Browse files Browse the repository at this point in the history
  • Loading branch information
Ryex authored May 23, 2024
1 parent b5d6ac5 commit 3b5e51c
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions lua/rustaceanvim/config/server.lua
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,21 @@ function server.load_rust_analyzer_settings(project_root, opts)
local default_settings = opts.default_settings or config.server.default_settings
local use_clippy = config.tools.enable_clippy and vim.fn.executable('cargo-clippy') == 1
---@diagnostic disable-next-line: undefined-field
if default_settings['rust-analyzer'].checkOnSave == nil and use_clippy then
if
default_settings['rust-analyzer'].check == nil
and use_clippy
and type(default_settings['rust-analyzer'].checkOnSave) ~= 'table'
then
---@diagnostic disable-next-line: inject-field
default_settings['rust-analyzer'].checkOnSave = {
default_settings['rust-analyzer'].check = {
allFeatures = true,
command = 'clippy',
extraArgs = { '--no-deps' },
}
if type(default_settings['rust-analyzer'].checkOnSave) ~= 'boolean' then
---@diagnostic disable-next-line: inject-field
default_settings['rust-analyzer'].checkOnSave = true
end
end
if not project_root then
return default_settings
Expand Down

0 comments on commit 3b5e51c

Please sign in to comment.