2020-05-17 18:14:43 +02:00
|
|
|
// aux-build:proc_macro_attr.rs
|
2018-07-28 17:34:52 +02:00
|
|
|
#![warn(clippy::empty_line_after_outer_attr)]
|
2019-01-23 09:49:02 +01:00
|
|
|
#![allow(clippy::assertions_on_constants)]
|
2019-02-27 06:41:07 +01:00
|
|
|
#![feature(custom_inner_attributes)]
|
|
|
|
#![rustfmt::skip]
|
|
|
|
|
2020-05-17 18:14:43 +02:00
|
|
|
#[macro_use]
|
|
|
|
extern crate proc_macro_attr;
|
|
|
|
|
2018-01-19 08:18:29 +01:00
|
|
|
// 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) }
|
|
|
|
|
|
|
|
|
2018-01-09 00:22:42 +01:00
|
|
|
// 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) }
|
|
|
|
|
2018-01-23 21:32:06 +01:00
|
|
|
|
|
|
|
// 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 {
|
|
|
|
}
|
|
|
|
|
2018-02-01 07:43:03 +01:00
|
|
|
/// This doc comment should not produce a warning
|
|
|
|
|
|
|
|
/** This is also a doc comment and should not produce a warning
|
|
|
|
*/
|
|
|
|
|
2018-01-09 00:22:42 +01:00
|
|
|
// This should not produce a warning
|
|
|
|
#[allow(non_camel_case_types)]
|
|
|
|
#[allow(missing_docs)]
|
|
|
|
#[allow(missing_docs)]
|
|
|
|
fn three_attributes() { assert!(true) }
|
|
|
|
|
2018-02-21 21:11:38 +01:00
|
|
|
// This should not produce a warning
|
|
|
|
#[doc = "
|
|
|
|
Returns the escaped value of the textual representation of
|
|
|
|
|
|
|
|
"]
|
|
|
|
pub fn function() -> bool {
|
|
|
|
true
|
|
|
|
}
|
|
|
|
|
2018-03-26 21:57:42 +02:00
|
|
|
// This should not produce a warning
|
|
|
|
#[derive(Clone, Copy)]
|
|
|
|
pub enum FooFighter {
|
|
|
|
Bar1,
|
|
|
|
|
|
|
|
Bar2,
|
|
|
|
|
|
|
|
Bar3,
|
|
|
|
|
|
|
|
Bar4
|
|
|
|
}
|
|
|
|
|
2018-03-30 12:36:30 +02:00
|
|
|
// This should not produce a warning because the empty line is inside a block comment
|
2018-03-29 21:14:53 +02:00
|
|
|
#[crate_type = "lib"]
|
|
|
|
/*
|
|
|
|
|
|
|
|
*/
|
|
|
|
pub struct S;
|
|
|
|
|
2018-03-30 12:36:30 +02:00
|
|
|
// This should not produce a warning
|
|
|
|
#[crate_type = "lib"]
|
|
|
|
/* test */
|
|
|
|
pub struct T;
|
|
|
|
|
2020-05-17 18:14:43 +02:00
|
|
|
// This should not produce a warning
|
|
|
|
// See https://github.com/rust-lang/rust-clippy/issues/5567
|
|
|
|
#[fake_async_trait]
|
|
|
|
pub trait Bazz {
|
|
|
|
fn foo() -> Vec<u8> {
|
|
|
|
let _i = "";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
vec![]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {}
|