brotzeit / rustic

Rust development environment for Emacs
Apache License 2.0
724 stars 101 forks source link

clippy options in `.cargo/config` causes constant rebuilds #412

Open jtracey opened 2 years ago

jtracey commented 2 years ago

I'm not sure if this is a bug in rustic, rust-analyzer, or lsp, and I haven't been very successful in tracking down what's going on, so feel free to point me elsewhere. When I open a file in the coreutils project, clippy is run as the linter. If I then run clippy from the command line, it treats it as a clean rebuild, and vice versa. It seems like the problem is the additional clippy flags in .cargo/config, like the cache is invalidated because they aren't being applied when run via rustic.

brotzeit commented 2 years ago

Can you show me your lsp-mode config please.

brotzeit commented 2 years ago

Can you try if it works when you add the config options to lsp-rust-analyzer-cargo-watch-args. But you're right it should pick up the config automatically.

appetrosyan commented 2 years ago

I would consider using the cargo lints package instead. https://lib.rs/crates/cargo-lints, it's supported by Rustic, and much more convenient.

appetrosyan commented 2 years ago

Additionally, the reason which causes a rebuild could be either one of the build.rs scripts.

https://github.com/uutils/coreutils/blob/70d8864fe146d2578ea100b3edeb17135d3e79c9/src/uu/factor/build.rs

appetrosyan commented 2 years ago

In fact, judging by how many scripts require you to ignore the build.rs I'd imagine that it's a little buggy and triggers a re-compilation when the dependencies haven't really changed.

appetrosyan commented 11 months ago

Update: cargo-lints is no longer maintained. The original workaround is not suitable anymore.