# Clippy behavior affected by incremental compilation

**URL:** <https://internals.rust-lang.org/t/clippy-behavior-affected-by-incremental-compilation/9436>\
**Category:** tools and infrastructure\
**Created:** [February 13, 2019, 7:58pm UTC](https://internals.rust-lang.org/t/clippy-behavior-affected-by-incremental-compilation/9436 "2019-02-13T19:58:44Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![ehuss](https://avatars.discourse-cdn.com/v4/letter/e/9de0a6/32.png) [@ehuss](https://internals.rust-lang.org/u/ehuss)\
**Post date:** [February 14, 2019, 5:20am UTC](https://internals.rust-lang.org/t/clippy-behavior-affected-by-incremental-compilation/9436/2 "2019-02-14T05:20:53Z")

</div>

This is tracked on the Clippy side with [https://github.com/rust-lang/rust-clippy/issues/2604](https://github.com/rust-lang/rust-clippy/issues/2604). For your point #1, you can use `touch src/lib.rs` or whatever your root source file is to force a recompile.

Recently there was support added to Cargo to force a rebuild for `cargo fix`, but it is not exposed externally. I’m not sure if this is the approach we ultimately want to go for clippy.

Eventually we want to cache diagnostic output. This is tracked in [https://github.com/rust-lang/cargo/issues/3624](https://github.com/rust-lang/cargo/issues/3624). It is a relatively tricky problem to handle cross-platform. Recently, the `fwdansi` crate was created and added to Cargo which is one of the steps to move this along. Cargo also now streams all rustc output, which was another step on this journey. I think at this point, the final bits need to be designed. Cargo needs to save off the diagnostics, and then replay them if the target is fresh. There are some tricky issues, like invalidating the cache if flags like `--color` or `--message-format` are changed. There was some discussion of always using JSON with rustc, and having Cargo responsible for re-rendering for text output, but that has additional complications (but some benefits).

I can try to take a look at moving this along sometime soonish.

---

_[View the full topic](https://internals.rust-lang.org/t/clippy-behavior-affected-by-incremental-compilation/9436)._
