Skip to content

Conversation

iorizu
Copy link
Contributor

@iorizu iorizu commented Sep 8, 2025

When the user pressed save in a source file that was part of a specific target, rust-analyzer would trigger two flychecks on the workspace that the file was a part of:

  • A package-level flycheck (cargo check -p <package> (--bin | --example | --test | --benchmark) <target>)
  • A workspace-level flycheck (cargo check --workspace)

The triggering of the second flycheck cancelled the first, so there was no correctness issue, but the behavior undesirable regardless.

This PR fixes this by making sure that the workspace level check is not triggered if a package check was already triggered.

Closes #20436

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Sep 8, 2025
@iorizu iorizu force-pushed the fix-double-flycheck branch 2 times, most recently from e09fef6 to d23bb31 Compare September 9, 2025 03:57
@iorizu iorizu changed the title Fix double flycheck when saving files that are part of targets fix: Don't trigger two flychecks when saving files that are part of targets Sep 9, 2025
@iorizu iorizu force-pushed the fix-double-flycheck branch 2 times, most recently from 7a7220e to ccc9c25 Compare September 11, 2025 15:32
@iorizu iorizu force-pushed the fix-double-flycheck branch from ccc9c25 to 8497cba Compare September 11, 2025 15:38
@ShoyuVanilla
Copy link
Member

Thanks for working on this! Unfortunately, I had no time to review this for days dealing with other issues on next-solver migration.
I'll review this tomorrow.

@iorizu
Copy link
Contributor Author

iorizu commented Sep 11, 2025

Take your time! This is a minor issue, after all.

Copy link
Member

@ShoyuVanilla ShoyuVanilla left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me. Thanks!

@ShoyuVanilla ShoyuVanilla added this pull request to the merge queue Sep 14, 2025
Merged via the queue into rust-lang:master with commit 5727ece Sep 14, 2025
15 checks passed
@rustbot rustbot removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Sep 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Flycheck is triggered multiple times on a single file save
3 participants