MISPLACED_DIAGNOSTIC_ATTRIBUTES

Static MISPLACED_DIAGNOSTIC_ATTRIBUTES 

Source
pub static MISPLACED_DIAGNOSTIC_ATTRIBUTES: &Lint
Expand description

The misplaced_diagnostic_attributes lint detects wrongly placed diagnostic attributes.

§Example

#[diagnostic::do_not_recommend]
struct NotUserFacing;

{{produces}}

§Explanation

It is usually a mistake to specify a diagnostic attribute on an item it is not meant for. For example, #[diagnostic::do_not_recommend] can only be placed on trait implementations, and does nothing if placed elsewhere. See the reference for a list of diagnostic attributes and their correct positions.