about summary refs log tree commit diff
path: root/src/tools/clippy/tests/ui/duplicated_attributes.rs
blob: 3ca91d6f1829c02b982c7af4a85962f7c848d877 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
//@aux-build:proc_macro_attr.rs
#![feature(rustc_attrs)]
#![warn(clippy::duplicated_attributes)]
#![cfg(any(unix, windows))]
#![allow(dead_code)]
#![allow(dead_code)] //~ ERROR: duplicated attribute
#![cfg(any(unix, windows))] // Should not warn!

#[macro_use]
extern crate proc_macro_attr;

#[cfg(any(unix, windows, target_os = "linux"))]
#[allow(dead_code)]
#[allow(dead_code)] //~ ERROR: duplicated attribute
#[cfg(any(unix, windows, target_os = "linux"))] // Should not warn!
fn foo() {}

#[cfg(unix)]
#[cfg(windows)]
#[cfg(unix)] // cfgs are not handled
fn bar() {}

// No warning:
#[rustc_on_unimplemented(on(Self = "&str", label = "`a"), on(Self = "alloc::string::String", label = "a"))]
trait Abc {}

#[proc_macro_attr::duplicated_attr()] // Should not warn!
fn babar() {}

#[allow(missing_docs, reason = "library for internal use only")]
#[allow(exported_private_dependencies, reason = "library for internal use only")]
fn duplicate_reason() {}

fn main() {}