I encountered something yesterday that I have written about previously.
I had bacon running with a clippy-all
target and it was warning about a bunch of unused variables, with suggestions that I should add a _
to silence the warning. I did so for a few of them and saved, and then bacon refreshed, but the entries were still showing, but with the new names. I.e. before it was saying that foo
and bar
where unused. I renamed them to _foo
and _bar
and after bacon had re-run clippy it reported the same warnings, but this time said that _foo
and _bar
were unused and that I could prefix them with _
to get rid of the warning(!).
I stopped bacon and ran cargo clippy
manually, but it produced the same results.
Last time this happened I wrote that I would archive the target directory so it could be inspected. Stupidly, I forgot this and instead ran cargo clean
, because I had some vague memory that this fixed the problem. And indeed it did, but then I remembered that I shouldn't have done that..
I'm curious about what manner of state is saved in the target directory that could cause this.
This weird state seems to be exceptionally rare, but I've seen it at least twice that I'm 100% certain of. I'm pretty sure I've seen the same problem, expressed in a different way, but I tend to quick-fire cargo clean
when I just need to continue working.
Just throwing it out there that sometimes if the warnings/errors don't seem to be keeping up with your changes, run cargo clean
and see it it makes it better. Or better yet, archive the target directory and then run cargo clean
.