rust-lang / rust-lang/rust-analyzer

add options and documentation for diagnostics

Open
#1,653 16 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

A-config S-actionable
Dominant language
Rust
Stars
16.9k
Forks
2.2k
Avg merge
1d 12h
Merged PRs (30d)
72

Description

Some of my code has been untouched for quite some time, and thus, doesn't always follow the latest conventions, such as using short-hand struct initialization. I have a lot of code to maintain, and updating all of it to adhere to these conventions is very time consuming. This is generally why I avoid Clippy (among other reasons, like there being too many false positives), and also why I occasionally squash deprecation warnings.

It seems like rust-analyzer has its own lints that it provides, seemingly called "diagnostics" in the source code, but I cannot figure out how to disable them. In particular, I have some code that is not using shorthand struct initialization everywhere, so rust-analyzer warns at every such instance, which is quite annoying.

It took me quite some to figure out where this warning was coming from. At first, I thought rust-analyzer was somehow embedding Clippy. And then I thought perhaps the compiler was emitting this warning (strange as that might be) and that I had somehow squashed this warning in the normal cargo build workflow in a way that wasn't getting picked up by rust-analyzer.

It wasn't until I grepped the rust-analyzer source code that I realized it was the one responsible for the warning.

I was pretty surprised by this, and generally did not expect rust-analyzer to also be a linter. Is it intended for rust-analyzer to stand up its own linting strategies separate from Clippy?

It would be very nice to have some docs on this and also a way to turn it off. In particular, if I run cargo build in my terminal and that exits cleanly, then I generally expect rust-analyzer to be similarly clean.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating rust-analyzer's diagnostics in its source, especially the shorthand struct initialization warning mentioned in the report. Define the documentation and configuration behavior for disabling these diagnostics; done means users can understand their origin and turn them off when desired.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
devtools, documentation
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.