0

I'm trying to lint my Rust project using cargo clippy --fix. In VSCode, while the command is running, I can see changes to the files being made in the Git submenu. However, after the command is complete, all changes seem to be reverted and all files are left in their original state. Any idea how I can make Clippy persist the changes?

kmdreko
  • 42,554
  • 6
  • 57
  • 106
Bobface
  • 2,782
  • 4
  • 24
  • 61
  • Any error messages? Two suspicions: 1) you have uncommitted git changes. Use `cargo clippy --fix --allow-dirty` to perform the changes anyway. 2) It's a VSCode caching thing, and you have to close/save the relevant files before running clippy. Clippy itself shouldn't revert anything. If `--fix` succeeds the files should actually be changed. Just checked for my own files, and it works as expected. – Finomnis Sep 16 '22 at 17:31
  • No error messages and no changed files before running the command. It doesn't seem to be related to VSCode either, since the same happens when I use a normal terminal. – Bobface Sep 16 '22 at 17:50
  • Can't reproduce, sadly. It works for me without a problem. Does this happen with newly created "hello world" crates as well? – Finomnis Sep 16 '22 at 21:00

0 Answers0