1 // NOTE: Entries should be created with `cargo dev deprecate`
3 /// This struct fakes the `Lint` declaration that is usually created by `declare_lint!`. This
4 /// enables the simple extraction of the metadata without changing the current deprecation
6 pub struct ClippyDeprecatedLint {
7 #[cfg(feature = "internal")]
12 macro_rules! declare_deprecated_lint {
13 { $(#[$attr:meta])* pub $name: ident, $reason: literal} => {
16 pub static $name: ClippyDeprecatedLint = ClippyDeprecatedLint {
17 #[cfg(feature = "internal")]
23 declare_deprecated_lint! {
25 /// Nothing. This lint has been deprecated.
27 /// ### Deprecation reason
28 /// This used to check for `assert!(a == b)` and recommend
29 /// replacement with `assert_eq!(a, b)`, but this is no longer needed after RFC 2011.
30 #[clippy::version = "pre 1.29.0"]
32 "`assert!()` will be more flexible with RFC 2011"
35 declare_deprecated_lint! {
37 /// Nothing. This lint has been deprecated.
39 /// ### Deprecation reason
40 /// This used to check for `Vec::extend`, which was slower than
41 /// `Vec::extend_from_slice`. Thanks to specialization, this is no longer true.
42 #[clippy::version = "pre 1.29.0"]
43 pub EXTEND_FROM_SLICE,
44 "`.extend_from_slice(_)` is a faster way to extend a Vec by a slice"
47 declare_deprecated_lint! {
49 /// Nothing. This lint has been deprecated.
51 /// ### Deprecation reason
52 /// `Range::step_by(0)` used to be linted since it's
53 /// an infinite iterator, which is better expressed by `iter::repeat`,
54 /// but the method has been removed for `Iterator::step_by` which panics
56 #[clippy::version = "pre 1.29.0"]
57 pub RANGE_STEP_BY_ZERO,
58 "`iterator.step_by(0)` panics nowadays"
61 declare_deprecated_lint! {
63 /// Nothing. This lint has been deprecated.
65 /// ### Deprecation reason
66 /// This used to check for `Vec::as_slice`, which was unstable with good
67 /// stable alternatives. `Vec::as_slice` has now been stabilized.
68 #[clippy::version = "pre 1.29.0"]
69 pub UNSTABLE_AS_SLICE,
70 "`Vec::as_slice` has been stabilized in 1.7"
73 declare_deprecated_lint! {
75 /// Nothing. This lint has been deprecated.
77 /// ### Deprecation reason
78 /// This used to check for `Vec::as_mut_slice`, which was unstable with good
79 /// stable alternatives. `Vec::as_mut_slice` has now been stabilized.
80 #[clippy::version = "pre 1.29.0"]
81 pub UNSTABLE_AS_MUT_SLICE,
82 "`Vec::as_mut_slice` has been stabilized in 1.7"
85 declare_deprecated_lint! {
87 /// Nothing. This lint has been deprecated.
89 /// ### Deprecation reason
90 /// This lint should never have applied to non-pointer types, as transmuting
91 /// between non-pointer types of differing alignment is well-defined behavior (it's semantically
92 /// equivalent to a memcpy). This lint has thus been refactored into two separate lints:
93 /// cast_ptr_alignment and transmute_ptr_to_ptr.
94 #[clippy::version = "pre 1.29.0"]
95 pub MISALIGNED_TRANSMUTE,
96 "this lint has been split into cast_ptr_alignment and transmute_ptr_to_ptr"
99 declare_deprecated_lint! {
101 /// Nothing. This lint has been deprecated.
103 /// ### Deprecation reason
104 /// This lint is too subjective, not having a good reason for being in clippy.
105 /// Additionally, compound assignment operators may be overloaded separately from their non-assigning
106 /// counterparts, so this lint may suggest a change in behavior or the code may not compile.
107 #[clippy::version = "1.30.0"]
109 "using compound assignment operators (e.g., `+=`) is harmless"
112 declare_deprecated_lint! {
114 /// Nothing. This lint has been deprecated.
116 /// ### Deprecation reason
117 /// The original rule will only lint for `if let`. After
118 /// making it support to lint `match`, naming as `if let` is not suitable for it.
119 /// So, this lint is deprecated.
120 #[clippy::version = "pre 1.29.0"]
121 pub IF_LET_REDUNDANT_PATTERN_MATCHING,
122 "this lint has been changed to redundant_pattern_matching"
125 declare_deprecated_lint! {
127 /// Nothing. This lint has been deprecated.
129 /// ### Deprecation reason
130 /// This lint used to suggest replacing `let mut vec =
131 /// Vec::with_capacity(n); vec.set_len(n);` with `let vec = vec![0; n];`. The
132 /// replacement has very different performance characteristics so the lint is
134 #[clippy::version = "pre 1.29.0"]
135 pub UNSAFE_VECTOR_INITIALIZATION,
136 "the replacement suggested by this lint had substantially different behavior"
139 declare_deprecated_lint! {
141 /// Nothing. This lint has been deprecated.
143 /// ### Deprecation reason
144 /// This lint has been superseded by #[must_use] in rustc.
145 #[clippy::version = "1.39.0"]
147 "`collect` has been marked as #[must_use] in rustc and that covers all cases of this lint"
150 declare_deprecated_lint! {
152 /// Nothing. This lint has been deprecated.
154 /// ### Deprecation reason
155 /// Associated-constants are now preferred.
156 #[clippy::version = "1.44.0"]
158 "associated-constants `MIN`/`MAX` of integers are preferred to `{min,max}_value()` and module constants"
161 declare_deprecated_lint! {
163 /// Nothing. This lint has been deprecated.
165 /// ### Deprecation reason
166 /// The regex! macro does not exist anymore.
167 #[clippy::version = "1.47.0"]
169 "the regex! macro has been removed from the regex crate in 2018"
172 declare_deprecated_lint! {
174 /// Nothing. This lint has been deprecated.
176 /// ### Deprecation reason
177 /// This lint has been replaced by `manual_find_map`, a
178 /// more specific lint.
179 #[clippy::version = "1.51.0"]
181 "this lint has been replaced by `manual_find_map`, a more specific lint"
184 declare_deprecated_lint! {
186 /// Nothing. This lint has been deprecated.
188 /// ### Deprecation reason
189 /// This lint has been replaced by `manual_filter_map`, a
190 /// more specific lint.
191 #[clippy::version = "1.53.0"]
193 "this lint has been replaced by `manual_filter_map`, a more specific lint"
196 declare_deprecated_lint! {
198 /// Nothing. This lint has been deprecated.
200 /// ### Deprecation reason
201 /// The `avoid_breaking_exported_api` config option was added, which
202 /// enables the `enum_variant_names` lint for public items.
203 #[clippy::version = "1.54.0"]
204 pub PUB_ENUM_VARIANT_NAMES,
205 "set the `avoid-breaking-exported-api` config option to `false` to enable the `enum_variant_names` lint for public items"
208 declare_deprecated_lint! {
210 /// Nothing. This lint has been deprecated.
212 /// ### Deprecation reason
213 /// The `avoid_breaking_exported_api` config option was added, which
214 /// enables the `wrong_self_conversion` lint for public items.
215 #[clippy::version = "1.54.0"]
216 pub WRONG_PUB_SELF_CONVENTION,
217 "set the `avoid-breaking-exported-api` config option to `false` to enable the `wrong_self_convention` lint for public items"