Description
Today, in our company workspace, when I save a file in a binary leaf crate - e.g. an alteration to main.rs
, it takes:
- 40 seconds for rust-analyzer to run clippy on all the members
- or 40 seconds for it to run check on all the members
- or 2 seconds to run clippy on the member
- or 2 seconds to run check on the member
Depending on what check-on-save command I am using and the value of check.workspace.
With just cargo at the command line,
- 1 second to run clippy --workspace
- or 1 second to run check --workspace
Changing a mid-layer crate, and clippy --workspace takes ~ 4 seconds or so.
Which is fine, but the times from RA itself are not.
With check.workspace = True
, every crate in a workspace - we're at 90 - has the check command run when a file is saved.
This takes some time but when a public interface is changed and causes another crate to fail, that is picked up immediately.
With check.workspace = False
, only the package the file belongs to is rechecked, but changes that alter public interfaces go unnoticed until those other crates are saved.
What I would love is a version that runs check on the closure of the reverse dependencies of the package the saved file was in.
For example, imagine that we have a proc macro crate, a library that works in concert with that proc macro crate - including re-exporting it, and a binary:
binary
- library
- proc-macro
saving a file in binary would check binary
saving a file in library would check binary and library
saving a file in proc-macro would check binary and library and proc-macro
Alternatively, if RA would literally run 'clippy --workspace' or 'check --workspace' that would also solve things.