11mod allow_attributes;
22mod allow_attributes_without_reason;
33mod blanket_clippy_restriction_lints;
4+ mod deprecated_attributes_without_note;
45mod deprecated_attributes_without_since;
56mod deprecated_cfg_attr;
67mod deprecated_semver;
@@ -106,6 +107,28 @@ declare_clippy_lint! {
106107 "enabling the complete restriction group"
107108}
108109
110+ declare_clippy_lint ! {
111+ /// ### What it does
112+ /// Checks for attributes that deprecate items without a `note` field.
113+ ///
114+ /// ### Why restrict this?
115+ /// This is typically used to provide an explanation about the deprecation
116+ /// and preferred alternatives.
117+ ///
118+ /// ### Example
119+ /// ```no_run
120+ /// #[deprecated]
121+ /// ```
122+ /// Use instead:
123+ /// ```no_run
124+ /// #[deprecated(note = "foo was rarely used. Users should instead use bar")]
125+ /// ```
126+ #[ clippy:: version = "1.100.0" ]
127+ pub DEPRECATED_ATTRIBUTES_WITHOUT_NOTE ,
128+ restriction,
129+ "ensures that all `deprecated` attributes have a `note` field"
130+ }
131+
109132declare_clippy_lint ! {
110133 /// ### What it does
111134 /// Checks for attributes that deprecate items without a `since` field.
@@ -504,6 +527,7 @@ declare_clippy_lint! {
504527}
505528
506529impl_lint_pass ! ( Attributes => [
530+ DEPRECATED_ATTRIBUTES_WITHOUT_NOTE ,
507531 DEPRECATED_ATTRIBUTES_WITHOUT_SINCE ,
508532 INLINE_ALWAYS ,
509533 REPR_PACKED_WITHOUT_ABI ,
@@ -618,6 +642,7 @@ impl EarlyLintPass for PostExpansionEarlyAttributes {
618642 }
619643 if matches ! ( name, sym:: deprecated) {
620644 deprecated_attributes_without_since:: check ( cx, Some ( items) , attr) ;
645+ deprecated_attributes_without_note:: check ( cx, Some ( items) , attr) ;
621646 }
622647 if is_lint_level ( name) {
623648 blanket_clippy_restriction_lints:: check ( cx, name, items) ;
@@ -634,6 +659,11 @@ impl EarlyLintPass for PostExpansionEarlyAttributes {
634659 }
635660 }
636661 } else if attr. has_name ( sym:: deprecated) {
662+ if let AttrKind :: Normal ( normal_attr) = & attr. kind
663+ && !matches ! ( normal_attr. item. args, AttrArgs :: Eq { .. } )
664+ {
665+ deprecated_attributes_without_note:: check ( cx, None , attr) ;
666+ }
637667 deprecated_attributes_without_since:: check ( cx, None , attr) ;
638668 }
639669
0 commit comments