mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-11 15:37:15 +00:00
034c81b761
`empty_line_after_outer_attribute` produced a false positive warning when deriving `Copy` and/or `Clone` for an item. It looks like the second point in [this comment][that_comment] is related, as the attribute that causes the false positive has a path of `rustc_copy_clone_marker`. Fixes #2475 [that_comment]: https://github.com/rust-lang/rust/issues/35900#issuecomment-245978831
82 lines
1.3 KiB
Rust
82 lines
1.3 KiB
Rust
|
|
#![warn(empty_line_after_outer_attr)]
|
|
|
|
// This should produce a warning
|
|
#[crate_type = "lib"]
|
|
|
|
/// some comment
|
|
fn with_one_newline_and_comment() { assert!(true) }
|
|
|
|
// This should not produce a warning
|
|
#[crate_type = "lib"]
|
|
/// some comment
|
|
fn with_no_newline_and_comment() { assert!(true) }
|
|
|
|
|
|
// This should produce a warning
|
|
#[crate_type = "lib"]
|
|
|
|
fn with_one_newline() { assert!(true) }
|
|
|
|
// This should produce a warning, too
|
|
#[crate_type = "lib"]
|
|
|
|
|
|
fn with_two_newlines() { assert!(true) }
|
|
|
|
|
|
// This should produce a warning
|
|
#[crate_type = "lib"]
|
|
|
|
enum Baz {
|
|
One,
|
|
Two
|
|
}
|
|
|
|
// This should produce a warning
|
|
#[crate_type = "lib"]
|
|
|
|
struct Foo {
|
|
one: isize,
|
|
two: isize
|
|
}
|
|
|
|
// This should produce a warning
|
|
#[crate_type = "lib"]
|
|
|
|
mod foo {
|
|
}
|
|
|
|
/// This doc comment should not produce a warning
|
|
|
|
/** This is also a doc comment and should not produce a warning
|
|
*/
|
|
|
|
// This should not produce a warning
|
|
#[allow(non_camel_case_types)]
|
|
#[allow(missing_docs)]
|
|
#[allow(missing_docs)]
|
|
fn three_attributes() { assert!(true) }
|
|
|
|
// This should not produce a warning
|
|
#[doc = "
|
|
Returns the escaped value of the textual representation of
|
|
|
|
"]
|
|
pub fn function() -> bool {
|
|
true
|
|
}
|
|
|
|
// This should not produce a warning
|
|
#[derive(Clone, Copy)]
|
|
pub enum FooFighter {
|
|
Bar1,
|
|
|
|
Bar2,
|
|
|
|
Bar3,
|
|
|
|
Bar4
|
|
}
|
|
|
|
fn main() { }
|