Closed jgarte closed 7 months ago
rust-mode doesn't contain any flycheck related code. We only added a link to make it easier for users. I actually don't know if flymake supports rust but I would be surprised if it doesn't. It's intended to be used with eglot so I'm sure it works at least with lsp(eglot).
When I turn on flymake-mode
with eglot
and rust-analyzer
I don't get any clippy/linter warnings. Completions work though for me.
I tried the functions in rust-mode that relate to running clippy and those do work but they are manual and don't pass through flymake-mode from what I experienced.
I don't use eglot so I'm not sure what's necessary to get it working. You have to change the command from check to clippy. This is from the rust-analyzer package.json:
"rust-analyzer.checkOnSave.command": {
"markdownDescription": "Cargo command to use for `cargo check`.",
"default": "check",
"type": "string"
},
Maybe ask on the doom discord channel, I think there are plenty eglot users. Sorry but this is not related to rust-mode or rustic.
If you find a solution it would be great if we could also add it to the rust-mode repo. I'm sure there are others with the same issue.
I was able to get flymake working with rust-mode
and lsp-mode
. Since I had flycheck installed, I had to do this:
(use-package lsp-mode
:ensure t
:init (setq lsp-keymap-prefix "C-l")
:commands lsp
:hook ((lsp-mode . lsp-enable-which-key-integration)
(lsp-configure . lsp-lens-mode))
:custom
(lsp-diagnostics-provider :flymake))
And then for the rust-mode, this was the configuration:
(use-package rust-mode
:ensure t
:after (lsp-mode)
:hook ((rust-mode . lsp-deferred)))
I could confirm that the error that was show in the flymake diagnostic buffer was the same one which was shown in flycheck. (Although I did get less information in flymake like there was no Rust error code visible in the flymake one etc).
I didn't realize flymake support was merged :+1:
Closing this since nothing needs to be done at rust-mode for this.
Hi, does rust-mode support using flymake instead of flycheck?