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

Coccinelle files generated by Clippy? #13516

Open
leonardo-m opened this issue Oct 7, 2024 · 1 comment
Open

Coccinelle files generated by Clippy? #13516

leonardo-m opened this issue Oct 7, 2024 · 1 comment

Comments

@leonardo-m
Copy link

An idea is to add a switch to Clippy to make it generate a Coccinelle file that fixes a good part of the problems that Clippy has found in a source file.

Info about the Coccinelle tool for Rust:

https://gitlab.inria.fr/coccinelle/coccinelleforrust/

https://docs.kernel.org/dev-tools/coccinelle.html

https://lwn.net/SubscriberLink/991399/8bfb2ec24205dbaa/

https://kangrejos.com/2024/Coccinelle%20for%20Rust.pdf

@y21
Copy link
Member

y21 commented Oct 7, 2024

This sounds like a problem that's already solved by cargo clippy --fix? Or is this doing something else?

If not, I feel like this should either be implemented in rustc, or more realistically, as a separate tool (you can get warnings and suggestions from rustc in a JSON format with --error-format=json).
Clippy warnings and suggestions are no different from rustc's suggestions so if this exists this could trivially also work for rustc warnings and any other linter/tool that uses the compiler APIs for emitting suggestions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants