Handle rustc_on_unimplemented in duplicated_attributes
This commit is contained in:
parent
852a64f875
commit
b10be16702
@ -36,9 +36,10 @@ fn check_duplicated_attr(
|
||||
}
|
||||
let Some(ident) = attr.ident() else { return };
|
||||
let name = ident.name;
|
||||
if name == sym::doc || name == sym::cfg_attr {
|
||||
if name == sym::doc || name == sym::cfg_attr || name == sym::rustc_on_unimplemented {
|
||||
// FIXME: Would be nice to handle `cfg_attr` as well. Only problem is to check that cfg
|
||||
// conditions are the same.
|
||||
// `#[rustc_on_unimplemented]` contains duplicated subattributes, that's expected.
|
||||
return;
|
||||
}
|
||||
if let Some(direct_parent) = parent.last()
|
||||
|
@ -1,5 +1,5 @@
|
||||
//@aux-build:proc_macro_attr.rs
|
||||
|
||||
#![feature(rustc_attrs)]
|
||||
#![warn(clippy::duplicated_attributes)]
|
||||
#![cfg(any(unix, windows))]
|
||||
#![allow(dead_code)]
|
||||
@ -20,6 +20,10 @@ fn foo() {}
|
||||
#[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() {}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user