rust-lang / rust-lang/rust-analyzer

Default lints should correspond to rustc

Open
#16,628 9 comments 4 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

A-diagnostics C-support
Dominant language
Rust
Stars
16.9k
Forks
2.2k
Avg merge
1d 12h
Merged PRs (30d)
72

Description

Summary

I would expect that rust-analyzer, with default settings, would report the same lints (warnings, errors, etc.) as rustc

Details

Currently this is not the case; for example I also see messages about these:

  • inactive-code — this may have a special purpose in some editors? In Kate it's more annoying than useful, but that may be just Kate.
  • remove-unnecessary-else — nearest equivalent is Clippy's redundant_else?

The default enabled lints also do not correspond to Clippy's default lints (there is a note in the manual about enabling Clippy by default).

Motivation

I would (naively) expect that a project which is clean (reports no lints) under cargo check is also clean under rust-analyzer, and vice-versa. This makes it easier for developers using different tools to collaborate on a project.

Further motivation: the rust-analyzer project should probably not be responsible for choosing which lints are enabled by default (especially when both rustc and clippy already do this).

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 comparing rust-analyzer's default diagnostics with rustc via cargo check, then review the examples in the issue and Clippy's default lint list. Done means the default rust-analyzer lints consistently match the intended rustc behavior, with a clear decision about how Clippy-related lints are handled.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
compilers, devtools
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.