Skip to content

Commit

Permalink
fix(enable_clippy): use correct rust-analyzer config key
Browse files Browse the repository at this point in the history
The correct config key for a rust-analyzer check command table is `check`. `checkOnSave` is a boolean
 (there are some hints in the manual that `checkOnSave` as a table is aliased to `check` but even if it is the correct key is `check`)

this prevents incorrect config conflicts downstream
  • Loading branch information
Ryex authored May 20, 2024
1 parent b5d6ac5 commit 116615a
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lua/rustaceanvim/config/server.lua
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,15 @@ 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 then
---@diagnostic disable-next-line: inject-field
default_settings['rust-analyzer'].checkOnSave = {
default_settings['rust-analyzer'].check = {
allFeatures = true,
command = 'clippy',
extraArgs = { '--no-deps' },
}
---@diagnostic disable-next-line: inject-field
default_settings['rust-analyzer'].checkOnSave = true
end
if not project_root then
return default_settings
Expand Down

0 comments on commit 116615a

Please sign in to comment.