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

Apply Clippy's --fix to a single file. #5613

Open
JeanMertz opened this issue May 18, 2020 · 2 comments
Open

Apply Clippy's --fix to a single file. #5613

JeanMertz opened this issue May 18, 2020 · 2 comments
Labels
C-question Category: Questions

Comments

@JeanMertz
Copy link
Contributor

I've been testing clippy --fix since #5363 got merged, and it's working great ❤️.

I've been thinking on integrating it into my editor similar to how rustfmt runs when I save a file.

Currently, clippy --fix fixes all issues in a project. Running clippy against a single file isn't useful (or supported), since it needs the context of a single crate to be able to report certain problems (e.g. unused variables, etc).

However, a combination of "check entire crate", combined with "apply fixes for this one file", would make it possible to integrate Clippy in an editor by applying fixes to the active file, while still checking the entire crate for contextual information it needs.

I'm curious if this is something that sounds interesting to pursuit. I'm not sure what the UX around this feature would be, but I guess it would be to provide --fix, and also some kind of repeatable --fix-file to fix any issues in one or more files?

@flip1995
Copy link
Member

I think this would have to be implemented in cargo though, since Clippy doesn't really do anything when run with --fix, except running cargo fix with Clippy enabled.

@yaahc may have more insights here.

@flip1995 flip1995 added the C-question Category: Questions label May 19, 2020
@yaahc
Copy link
Member

yaahc commented May 19, 2020

Yea, this is a cargo change, though we can definitely do it. cc @ehuss

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-question Category: Questions
Projects
None yet
Development

No branches or pull requests

3 participants