rust-lang / rust-lang/rust-analyzer

Running the main function or tests from VSCode extension causes the linting within the editor to change

Open
#23,393 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

When I use the "Run" action on the main function or the "Run Tests" or "Run Test" actions on tests, the linting of the resulting code file changes. Specifically, I see the following effects:

  • Unused code is no longer greyed out
  • I have set the rust-analyzer.diagnostics.warningsAsHint option to not highlight unused code. This option does not seem to work in this context and I get yellow underlines under unused variables again.
    Saving a file returns linting to normal.

I would expect none of these actions to affect linting within the editor, similar to running directly from the command line.

rust-analyzer version: 0.3.3049-standalone

rustc version: 1.98.1

editor or extension: VSCode

OS: Windows 11

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

Reproduce the issue in the VSCode extension using the Run, Run Tests, and Run Test actions, with rust-analyzer.diagnostics.warningsAsHint configured. Compare editor diagnostics before and after each action, then save the file to confirm the reset; done means these actions no longer alter linting or warning presentation.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust, vscode
Domain
devtools
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
58/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.