fork/rust
git clone https://git.julia.blue/fork/rust
3bcad65fbf6
master
1//@aux-build:proc_macros.rs 2#![allow(unused)] 3#![warn(clippy::allow_attributes)] 4#![feature(lint_reasons)] 5#![no_main] 6 7extern crate proc_macros; 8use proc_macros::{external, with_span}; 9 10// Using clippy::needless_borrow just as a placeholder, it isn't relevant. 11 12// Should lint 13#[expect(dead_code)] 14struct T1; 15 16struct T2; // Should not lint 17#[deny(clippy::needless_borrow)] // Should not lint 18struct T3; 19#[warn(clippy::needless_borrow)] // Should not lint 20struct T4; 21// `panic = "unwind"` should always be true 22#[cfg_attr(panic = "unwind", expect(dead_code))] 23struct CfgT; 24 25#[allow(clippy::allow_attributes, unused)] 26struct Allowed; 27 28#[expect(clippy::allow_attributes)] 29#[allow(unused)] 30struct Expected; 31 32fn ignore_external() { 33 external! { 34 #[allow(clippy::needless_borrow)] // Should not lint 35 fn a() {} 36 } 37} 38 39fn ignore_proc_macro() { 40 with_span! { 41 span 42 #[allow(clippy::needless_borrow)] // Should not lint 43 fn a() {} 44 } 45} 46 47fn ignore_inner_attr() { 48 #![allow(unused)] // Should not lint 49}