Skip to content

Detect broken crate attributes #1165

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

Closed
nox opened this issue Aug 16, 2016 · 6 comments
Closed

Detect broken crate attributes #1165

nox opened this issue Aug 16, 2016 · 6 comments
Labels
C-enhancement Category: Enhancement of lints, like adding more cases or adding help messages good first issue These issues are a good way to get started with Clippy L-correctness Lint: Belongs in the correctness lint group

Comments

@nox
Copy link

nox commented Aug 16, 2016

I want to avoid this embarrassing commit next time: servo/hyper_serde@b1f2eac

@oli-obk
Copy link
Contributor

oli-obk commented Aug 16, 2016

I just made the exact same mistake 2 hours ago...

@oli-obk
Copy link
Contributor

oli-obk commented Aug 17, 2016

So... that one would have been caught. But it would be nice if we'd detect empty lines between a #[allow(foo)] attribute and the next item. So I'm leaving this open

@oli-obk oli-obk added good first issue These issues are a good way to get started with Clippy C-enhancement Category: Enhancement of lints, like adding more cases or adding help messages L-correctness Lint: Belongs in the correctness lint group labels Aug 17, 2016
@mcarton
Copy link
Member

mcarton commented Aug 17, 2016

Dupe of #770.

@phansch
Copy link
Member

phansch commented Jan 6, 2018

This seems straightforward for a first lint, so I'll work on detecting newlines after attributes in the next couple of days 👍

@phansch
Copy link
Member

phansch commented Jan 6, 2018

Hmm, as I learned in #1378 that clippy only works on the AST which doesn't include empty lines obviously. This seems a bit more difficult now, and maybe something for rustfmt instead? Or is there some other way to look for empty lines @oli-obk?

@oli-obk
Copy link
Contributor

oli-obk commented Jan 8, 2018

@phansch you can create a span from the attribute to the following item, then use the snippet_opt function to get the text and check whether there are empty newlines in that text

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-enhancement Category: Enhancement of lints, like adding more cases or adding help messages good first issue These issues are a good way to get started with Clippy L-correctness Lint: Belongs in the correctness lint group
Projects
None yet
Development

No branches or pull requests

5 participants