#Sould clippy run incrementally?

19 messages · Page 1 of 1 (latest)

balmy nova
#

I recently started using clippy. I have VSCode set up to run clippy on save. I assumed this was a good way to run it seeing as it is provided as an option. However I'm finding it runs very slowly so every time I save the file in order to run cargo run, I have to wait for clippy. It is also running even if I have made no changes and just hit save again. For example I just cloned the rust-headless-chrome repo and I am running their wikipedia example. Everytime I hit save clippy runs for about 40 seconds, even if I haven't made any changes. Is this normal or is something wrong with my setup? Does clippy not work incrementally, ie only re-evaluate code that has actually changed?

velvet void
#

that’s surprising, I’ve never had performance issues with Clippy before

#

is it possible that you’re running other Cargo commands in between that affects RUSTFLAGS or feature flags or something, and that’s causing a rebuild?

#

Try setting rust-analyzer.cargo.targetDir to true in your config – is Clippy still slow?

balmy nova
#

Hhmm, well it's good to know that it can be better and is obviously just something wrong with my setup. I tried adding that setting and clippy still runs for about 40 seconds every time I hit save. These are the Rust related settings I have in VSCode's settting.json:

{
    "rust-analyzer.cargo.buildScripts.enable": true,
    "rust-analyzer.inlayHints.lifetimeElisionHints.enable": "always",
    "rust-analyzer.lens.implementations.enable": false,
    "rust-analyzer.procMacro.attributes.enable": false,
    "rust-analyzer.procMacro.enable": false,
    "rust-analyzer.check.command": "clippy",
    "rust-analyzer.cargo.targetDir": true,
}
velvet void
#

just to make sure

#

And how long does cargo clippy take on the command-line?

balmy nova
#

I don't know how to check if the settings are being applied. VSCode seems to grey out settings it doesn't recognise/have been deprecated, and it doesn't do that for any of these settings but beyond that I don't know.
I tried cargo clippy and the first time it took about 40 seconds, mostly on this step:

max@max-Latitude-7290:~/projects/rust-headless-chrome$ cargo clippy
   Compiling headless_chrome v1.0.15 (/home/max/projects/rust-headless-chrome)
    Building [=======================> ] 139/140: headless_chrome  

After that it ran instantly, until I tried hitting save again in the editor and then cargo clippy would run slow again once, then quick after.
Seems like the problem the problem is specifically with the rust-headless-chrome repo. I tried saving files without changes in one of my own repos and it does run slow at first at a change but then runs instantly so is obviously successfully caching the work.
I tried setting "rust-analyzer.cargo.buildScripts.enable": false, to see if that would help with the headless_chrome problem but it made no differnce. I think I'll just make a new repo, rather than playing around with their example directly in the rust-headless-chrome repo.

velvet void
#

that is weird

#

yeah a reproduction would help

balmy nova
#

I've copied the example to a new repo and clippy works fine there, so I'm just going to use that instead. Thanks for your help.

inland snow
#

Clippy (and all the build tools) have a hard time with large projects

median wing
velvet void
#

that shouldn’t affect Clippy

median wing
velvet void
#

Maybe for proc macros I guess?

#

still, Clippy does not run the build process

median wing