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

Fix false positive in empty_line_after_outer_attr #2419

Merged
merged 1 commit into from
Feb 5, 2018

Conversation

phansch
Copy link
Member

@phansch phansch commented Feb 1, 2018

See #2340 (comment)

Doc comments are syntactic sugar for #[doc] attributes, so this lint was
catching them, too.

This commit makes it so that doc comments are ignored in this lint.

I think, for normal attributes it makes sense to warn about following empty
lines, for doc comments, less. This way the user has some freedom over
the formatting.

Doc comments are syntactic sugar for #[doc] attributes, so this lint was
catching them, too.

This commit makes it so that doc comments are ignored in this lint.

I think, for normal attributes it makes sense to warn about following empty
lines, for doc comments, less. This way the user has some freedom over
the formatting.
@phansch
Copy link
Member Author

phansch commented Feb 1, 2018

Another way to fix this could be to change the lint message if it is a doc comment (Found an empty line after a documentation comment ...). I'm not really sure what's better, though.

@oli-obk
Copy link
Contributor

oli-obk commented Feb 1, 2018

I'm not so sure about this one. I think doc comments should also be directly attached to their items without newlines inbetween. But I'm willing to go with it.

Alternatively we could make it two lints, one for doc comments and one for attributes and make the one for doc comments allow-by-default

@oli-obk oli-obk added the S-needs-discussion Status: Needs further discussion before merging or work can be started label Feb 1, 2018
@kpp
Copy link

kpp commented Feb 1, 2018

I got tons of warnings. https://github.com/tox-rs/tox/blob/master/src/toxencryptsave/mod.rs#L75

warning: Found an empty line after an outer attribute. Perhaps you forgot to add a '!' to make it an inner attribute?
  --> src/toxencryptsave/mod.rs:75:1
   |
75 | / /** Bytes used to verify whether given data has been encrypted using **TES**.
76 | |     
77 | |     Located at the beginning of the encrypted data.
78 | | */
79 | | pub const MAGIC_NUMBER: &[u8; MAGIC_LENGTH] = b"toxEsave";
   | |_
   |
   = help: for further information visit https://rust-lang-nursery.github.io/rust-clippy/v0.0.184/index.html#empty_line_after_outer_attr

@oli-obk oli-obk merged commit bef2200 into rust-lang:master Feb 5, 2018
@phansch phansch deleted the fix_doc_comment_false_positive branch February 5, 2018 12:22
@phansch phansch added the T-macros Type: Issues with macros and macro expansion label Apr 4, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-needs-discussion Status: Needs further discussion before merging or work can be started T-macros Type: Issues with macros and macro expansion
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants