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
{
8 pub desc
: &'
static str,
12 macro_rules
! declare_deprecated_lint
{
13 { $(#[$attr:meta])* pub $name: ident, $reason: literal}
=> {
16 pub static $name
: ClippyDeprecatedLint
= ClippyDeprecatedLint
{
22 declare_deprecated_lint
! {
24 /// Nothing. This lint has been deprecated.
26 /// ### Deprecation reason
27 /// This used to check for `assert!(a == b)` and recommend
28 /// replacement with `assert_eq!(a, b)`, but this is no longer needed after RFC 2011.
29 #[clippy::version = "pre 1.29.0"]
31 "`assert!()` will be more flexible with RFC 2011"
34 declare_deprecated_lint
! {
36 /// Nothing. This lint has been deprecated.
38 /// ### Deprecation reason
39 /// This used to check for `Vec::extend`, which was slower than
40 /// `Vec::extend_from_slice`. Thanks to specialization, this is no longer true.
41 #[clippy::version = "pre 1.29.0"]
42 pub EXTEND_FROM_SLICE
,
43 "`.extend_from_slice(_)` is a faster way to extend a Vec by a slice"
46 declare_deprecated_lint
! {
48 /// Nothing. This lint has been deprecated.
50 /// ### Deprecation reason
51 /// `Range::step_by(0)` used to be linted since it's
52 /// an infinite iterator, which is better expressed by `iter::repeat`,
53 /// but the method has been removed for `Iterator::step_by` which panics
55 #[clippy::version = "pre 1.29.0"]
56 pub RANGE_STEP_BY_ZERO
,
57 "`iterator.step_by(0)` panics nowadays"
60 declare_deprecated_lint
! {
62 /// Nothing. This lint has been deprecated.
64 /// ### Deprecation reason
65 /// This used to check for `Vec::as_slice`, which was unstable with good
66 /// stable alternatives. `Vec::as_slice` has now been stabilized.
67 #[clippy::version = "pre 1.29.0"]
68 pub UNSTABLE_AS_SLICE
,
69 "`Vec::as_slice` has been stabilized in 1.7"
72 declare_deprecated_lint
! {
74 /// Nothing. This lint has been deprecated.
76 /// ### Deprecation reason
77 /// This used to check for `Vec::as_mut_slice`, which was unstable with good
78 /// stable alternatives. `Vec::as_mut_slice` has now been stabilized.
79 #[clippy::version = "pre 1.29.0"]
80 pub UNSTABLE_AS_MUT_SLICE
,
81 "`Vec::as_mut_slice` has been stabilized in 1.7"
84 declare_deprecated_lint
! {
86 /// Nothing. This lint has been deprecated.
88 /// ### Deprecation reason
89 /// This lint should never have applied to non-pointer types, as transmuting
90 /// between non-pointer types of differing alignment is well-defined behavior (it's semantically
91 /// equivalent to a memcpy). This lint has thus been refactored into two separate lints:
92 /// cast_ptr_alignment and transmute_ptr_to_ptr.
93 #[clippy::version = "pre 1.29.0"]
94 pub MISALIGNED_TRANSMUTE
,
95 "this lint has been split into cast_ptr_alignment and transmute_ptr_to_ptr"
98 declare_deprecated_lint
! {
100 /// Nothing. This lint has been deprecated.
102 /// ### Deprecation reason
103 /// This lint is too subjective, not having a good reason for being in clippy.
104 /// Additionally, compound assignment operators may be overloaded separately from their non-assigning
105 /// counterparts, so this lint may suggest a change in behavior or the code may not compile.
106 #[clippy::version = "1.30.0"]
108 "using compound assignment operators (e.g., `+=`) is harmless"
111 declare_deprecated_lint
! {
113 /// Nothing. This lint has been deprecated.
115 /// ### Deprecation reason
116 /// The original rule will only lint for `if let`. After
117 /// making it support to lint `match`, naming as `if let` is not suitable for it.
118 /// So, this lint is deprecated.
119 #[clippy::version = "pre 1.29.0"]
120 pub IF_LET_REDUNDANT_PATTERN_MATCHING
,
121 "this lint has been changed to redundant_pattern_matching"
124 declare_deprecated_lint
! {
126 /// Nothing. This lint has been deprecated.
128 /// ### Deprecation reason
129 /// This lint used to suggest replacing `let mut vec =
130 /// Vec::with_capacity(n); vec.set_len(n);` with `let vec = vec![0; n];`. The
131 /// replacement has very different performance characteristics so the lint is
133 #[clippy::version = "pre 1.29.0"]
134 pub UNSAFE_VECTOR_INITIALIZATION
,
135 "the replacement suggested by this lint had substantially different behavior"
138 declare_deprecated_lint
! {
140 /// Nothing. This lint has been deprecated.
142 /// ### Deprecation reason
143 /// This lint has been superseded by #[must_use] in rustc.
144 #[clippy::version = "1.39.0"]
146 "`collect` has been marked as #[must_use] in rustc and that covers all cases of this lint"
149 declare_deprecated_lint
! {
151 /// Nothing. This lint has been deprecated.
153 /// ### Deprecation reason
154 /// Associated-constants are now preferred.
155 #[clippy::version = "1.44.0"]
157 "associated-constants `MIN`/`MAX` of integers are preferred to `{min,max}_value()` and module constants"
160 declare_deprecated_lint
! {
162 /// Nothing. This lint has been deprecated.
164 /// ### Deprecation reason
165 /// The regex! macro does not exist anymore.
166 #[clippy::version = "1.47.0"]
168 "the regex! macro has been removed from the regex crate in 2018"
171 declare_deprecated_lint
! {
173 /// Nothing. This lint has been deprecated.
175 /// ### Deprecation reason
176 /// This lint has been replaced by `manual_find_map`, a
177 /// more specific lint.
178 #[clippy::version = "1.51.0"]
180 "this lint has been replaced by `manual_find_map`, a more specific lint"
183 declare_deprecated_lint
! {
185 /// Nothing. This lint has been deprecated.
187 /// ### Deprecation reason
188 /// This lint has been replaced by `manual_filter_map`, a
189 /// more specific lint.
190 #[clippy::version = "1.53.0"]
192 "this lint has been replaced by `manual_filter_map`, a more specific lint"
195 declare_deprecated_lint
! {
197 /// Nothing. This lint has been deprecated.
199 /// ### Deprecation reason
200 /// The `avoid_breaking_exported_api` config option was added, which
201 /// enables the `enum_variant_names` lint for public items.
202 #[clippy::version = "1.54.0"]
203 pub PUB_ENUM_VARIANT_NAMES
,
204 "set the `avoid-breaking-exported-api` config option to `false` to enable the `enum_variant_names` lint for public items"
207 declare_deprecated_lint
! {
209 /// Nothing. This lint has been deprecated.
211 /// ### Deprecation reason
212 /// The `avoid_breaking_exported_api` config option was added, which
213 /// enables the `wrong_self_conversion` lint for public items.
214 #[clippy::version = "1.54.0"]
215 pub WRONG_PUB_SELF_CONVENTION
,
216 "set the `avoid-breaking-exported-api` config option to `false` to enable the `wrong_self_convention` lint for public items"