rust-lang / rust-lang/rust

clippy 0.1.92 (f04e3dfc87 2025-10-19) Weird Linting highlights VSC LSP

Open
#148,210 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

C-bug needs-triage
Dominant language
Rust
Stars
119k
Forks
16.1k
PR merge metrics
PR metrics pending

Description

Summary

A redundant else{} block caused clippy to highlight TO THE END OF THE FILE. Link to folder with two screen recordings and image The first video shows me recreating the issue. The later one shows me trying to find varients of the issue, where at 0:20 the issue seems to reverse itself and it will only do the incorrect-highlight when I remove the redundant else{} block (not shown in the video). When it disappeared, however, It moved to another file (or more specifically the first open file in that tablist in VSC) as seen in the image

Reproducer

Actually, this was pretty simple:

use std::collections::HashSet;

fn main() {
    let _x = do_something();
    println!("Hello, world!");
}
fn do_something() -> HashSet<bool> {
    let bug = dbg!(
        [Some(true), None, Some(false)]
            .into_iter()
            .flatten()
            .collect::<HashSet<bool>>()
    ) else {
        println!("Failed to reproduce bug");
        return HashSet::new();
    };
    bug
}
fn do_something_else() {
    println!("WOrking...");
}
Version
rustc 1.92.0-nightly (f04e3dfc8 2025-10-19)
binary: rustc
commit-hash: f04e3dfc87d7e2b6ad53e7a52253812cd62eba50
commit-date: 2025-10-19
host: x86_64-unknown-linux-gnu
release: 1.92.0-nightly
LLVM version: 21.1.3
Additional Labels

No response

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 running the supplied Rust reproducer with rustc 1.92.0-nightly in the reported VS Code LSP setup, then compare the diagnostic highlight with the source span. The issue is done when the redundant else variation no longer highlights to the end of the file or another open file, while the actual lint remains correctly highlighted.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.