Skip to content

empty_line_after_outer_attr false positive with block comments #2583

Closed

Description

For the following code:

#[cfg(any(target_pointer_width = "32", target_pointer_width = "64"))]
/*

*/
pub struct S;

clippy 0.0.190 produces the following warning:

warning: Found an empty line after an outer attribute. Perhaps you forgot to add a '!' to make it an inner attribute?
 --> src/lib.rs:1:1
  |
1 | / #[cfg(any(target_pointer_width = "32", target_pointer_width = "64"))]
2 | | /*
3 | |
4 | | */
5 | | pub struct S;
  | |_
  |
  = note: #[warn(empty_line_after_outer_attr)] on by default
  = help: for further information visit https://rust-lang-nursery.github.io/rust-clippy/v0.0.190/index.html#empty_line_after_outer_attr

This false positive is not triggered when the attribute is derive rather than cfg, or if the item is a function rather than a struct.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: Clippy is not doing the correct thing

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions