I love using the LSP to get autocomplete and jump to definition and not much else. I intentionally disable the vast majority of features from Emacs eglot, however diagnostics (red / yellow squiggly lines) are pushed from the server to the client without any opt-in or opt-out possible using the LSP protocol, it's one of those weird corner cases that the spec forgot to cover. Is there a way to opt out of them using rust-analyzer specific configuration?
You can set rust-analyzer.checkOnSave to false to stop rust-analyzer from running cargo check when saving and thus avoid those diagnostics. And rust-analyzer.diagnostics.enable to disable the diagnostics built into rust-analyzer like syntax errors or mismatched argument counts.
User Manual lists all config options for rust-analyzer. As for where to put them, in case of vscode it would be directly in the user or workspace settings json file. For emacs it probably depends on which lsp client you are using. The lsp client is responsible for passing these config options to rust-analyzer.
To run cargo clippy instead of cargo check, you can set "rust-analyzer.check.command": "clippy".
but I'm not entirely sure how to translate checkOnSave or diagnostics.enable into that language. Guessing but maybe (:checkOnSave "false") ("false" rather than nil) for the former and (:diagnostics (:enable "???")) for the second.
While most errors and warnings provided by rust-analyzer come from the cargo check integration, there’s a growing number of diagnostics implemented using rust-analyzer’s own analysis. Some of these diagnostics don’t respect #[allow] or \#[deny] attributes yet, but can be turned off using the rust-analyzer.diagnostics.enable, rust-analyzer.diagnostics.experimental.enable or rust-analyzer.diagnostics.disabled settings.
but doesn't say what the values should be for any of those three settings. I guess that the two enable settings are string lists of features... would an empty string suffice to have nothing enabled? I would also guess that disabled would override any values specified in enabled since they might allow wildcards.
Apologies if I'm not seeing it in the docs! These things are sometimes very easy to find only once you know what you're looking.