Skip to main content

has_attr

Function has_attr 

Source
pub fn has_attr(attrs: &[Attribute], symbol: Symbol) -> bool
Expand description

Checks if an attribute is present.

NOTE: this does not work for most attributes:

  • parsed attributes: use find_attr! for these
  • tool attributes: these have multi-segmented names (and diagnostic attrs are parsed anyway)

At this time, these only work for lint attributes (allow, warn, etc) and derive helpers.

FIXME: remove after lint attributes are parsed