2023-07-27 08:23:04 -05:00
|
|
|
//@aux-build:proc_macros.rs
|
2022-03-03 16:57:35 -06:00
|
|
|
#![feature(lint_reasons)]
|
|
|
|
#![deny(clippy::allow_attributes_without_reason)]
|
2024-02-28 10:38:24 -06:00
|
|
|
#![allow(unfulfilled_lint_expectations, clippy::duplicated_attributes)]
|
2023-06-01 20:24:41 -05:00
|
|
|
|
|
|
|
extern crate proc_macros;
|
|
|
|
use proc_macros::{external, with_span};
|
2022-03-03 16:57:35 -06:00
|
|
|
|
|
|
|
// These should trigger the lint
|
|
|
|
#[allow(dead_code)]
|
|
|
|
#[allow(dead_code, deprecated)]
|
2023-06-01 20:24:41 -05:00
|
|
|
#[expect(dead_code)]
|
2022-03-03 16:57:35 -06:00
|
|
|
// These should be fine
|
|
|
|
#[allow(dead_code, reason = "This should be allowed")]
|
|
|
|
#[warn(dyn_drop, reason = "Warnings can also have reasons")]
|
|
|
|
#[warn(deref_nullptr)]
|
|
|
|
#[deny(deref_nullptr)]
|
|
|
|
#[forbid(deref_nullptr)]
|
|
|
|
|
2023-06-01 20:24:41 -05:00
|
|
|
fn main() {
|
|
|
|
external! {
|
|
|
|
#[allow(dead_code)]
|
|
|
|
fn a() {}
|
|
|
|
}
|
|
|
|
with_span! {
|
|
|
|
span
|
|
|
|
#[allow(dead_code)]
|
|
|
|
fn b() {}
|
|
|
|
}
|
|
|
|
}
|
2023-06-03 18:34:12 -05:00
|
|
|
|
|
|
|
// Make sure this is not triggered on `?` desugaring
|
|
|
|
|
2023-06-03 18:35:53 -05:00
|
|
|
pub fn trigger_fp_option() -> Option<()> {
|
2023-06-03 18:34:12 -05:00
|
|
|
Some(())?;
|
|
|
|
None?;
|
|
|
|
Some(())
|
|
|
|
}
|
|
|
|
|
|
|
|
pub fn trigger_fp_result() -> Result<(), &'static str> {
|
|
|
|
Ok(())?;
|
|
|
|
Err("asdf")?;
|
|
|
|
Ok(())
|
|
|
|
}
|