Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

clippy --fix now errors on untracked files #10261

Open
bryanlarsen opened this issue Jan 30, 2023 · 1 comment
Open

clippy --fix now errors on untracked files #10261

bryanlarsen opened this issue Jan 30, 2023 · 1 comment
Labels
C-bug Category: Clippy is not doing the correct thing

Comments

@bryanlarsen
Copy link

Summary

After upgrading to rust 1.67.0 clippy --fix now fails if you have any untracked files in your git repository. I now have to pass the --allow-dirty flag to use clippy --fix. I didn't have to do this in rust 1.66.0.

If this is a deliberate change, I suggest adding an --allow-untracked flag to clippy --fix so that we can get the old behavior back.

Reproducer

reproduce:

cargo new foo
cd foo
git add .
git commit -m "Initial commit"
touch bar.txt
cargo clippy --fix

I expected to see this happen: Success

Instead, this happened:

error: the working directory of this package has uncommitted changes, and `cargo fix` can potentially perform destructive changes; if you'd like to suppress this error pass `--allow-dirty`, `--allow-staged`, or commit the changes to these files:

  * bar.txt (dirty)

Version

rustc 1.67.0 (fc594f156 2023-01-24)
binary: rustc
commit-hash: fc594f15669680fa70d255faec3ca3fb507c3405
commit-date: 2023-01-24
host: x86_64-unknown-linux-gnu
release: 1.67.0
LLVM version: 15.0.6

Additional Labels

No response

@bryanlarsen bryanlarsen added the C-bug Category: Clippy is not doing the correct thing label Jan 30, 2023
@Alexendoo
Copy link
Member

This'll be from rust-lang/cargo#11400 (the --fix functionality is powered by cargo fix)

It'd be good to add a comment/open an issue there if this has hit your workflow

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: Clippy is not doing the correct thing
Projects
None yet
Development

No branches or pull requests

2 participants