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

cargo clippy --explain <lintname> #8291

Closed
matthiaskrgr opened this issue Jan 15, 2022 · 4 comments · Fixed by #8952
Closed

cargo clippy --explain <lintname> #8291

matthiaskrgr opened this issue Jan 15, 2022 · 4 comments · Fixed by #8952
Labels
A-ui Area: Clippy interface, usage and configuration C-an-interesting-project Category: Interesting projects, that usually are more involved design/code wise. C-enhancement Category: Enhancement of lints, like adding more cases or adding help messages

Comments

@matthiaskrgr
Copy link
Member

matthiaskrgr commented Jan 15, 2022

Description

Rustc has this nice rustc --explain E060 feature.
I wonder if we could have the same in form of cargo clippy --explain needless_borrow for example.
This would print the lints explanation of the doc-comment ( https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow ) into the terminal, the advantage being that we don't need a web browser and internet to access the lint explanation 🙂

@matthiaskrgr matthiaskrgr added the A-ui Area: Clippy interface, usage and configuration label Jan 15, 2022
@xFrednet xFrednet added C-an-interesting-project Category: Interesting projects, that usually are more involved design/code wise. C-enhancement Category: Enhancement of lints, like adding more cases or adding help messages I-nominated Issue: Nominated to be discussed at the next Clippy meeting labels Jan 15, 2022
@xFrednet
Copy link
Member

xFrednet commented Jan 15, 2022

I've added the nominated tag to discuss this in the next meeting. Having this sounds like a good idea 🙃

@xFrednet
Copy link
Member

xFrednet commented Jan 25, 2022

FYI: This was discussed in today's meeting (See Zulip). Everyone agreed that this is a good idea and @llogiq wants to work on this.

@rustbot label -I-nominated

@rustbot rustbot removed the I-nominated Issue: Nominated to be discussed at the next Clippy meeting label Jan 25, 2022
@llogiq
Copy link
Contributor

llogiq commented Jan 27, 2022

I wonder how to best store the collected data. To start, I'm going to build a macro that will move the doc comment to a string argument.

@xFrednet
Copy link
Member

xFrednet commented Jan 27, 2022

Sounds like a good idea, the Metadata collector for our lint list collects the docs from the doc comment. If you change the macro it would be good to reapply the doc comments to the lint item.

Storage will be an interesting problem, I've looked into some ideas while I was working on #8211 but haven't found a nice solution yet. I thought about building a wrapper type about rustc's lint to store some additional Clippy data, but that didn't feel quite right to only implement nightly lints. I'm interested to see what you come up with 🙃

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-ui Area: Clippy interface, usage and configuration C-an-interesting-project Category: Interesting projects, that usually are more involved design/code wise. C-enhancement Category: Enhancement of lints, like adding more cases or adding help messages
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants