1 /// This struct fakes the `Lint` declaration that is usually created by `declare_lint!`. This
2 /// enables the simple extraction of the metadata without changing the current deprecation
4 pub struct ClippyDeprecatedLint;
6 macro_rules! declare_deprecated_lint {
7 { $(#[$attr:meta])* pub $name: ident, $_reason: expr} => {
10 pub static $name: ClippyDeprecatedLint = ClippyDeprecatedLint {};
14 declare_deprecated_lint! {
16 /// Nothing. This lint has been deprecated.
18 /// ### Deprecation reason
19 /// This used to check for `assert!(a == b)` and recommend
20 /// replacement with `assert_eq!(a, b)`, but this is no longer needed after RFC 2011.
22 "`assert!()` will be more flexible with RFC 2011"
25 declare_deprecated_lint! {
27 /// Nothing. This lint has been deprecated.
29 /// ### Deprecation reason
30 /// This used to check for `Vec::extend`, which was slower than
31 /// `Vec::extend_from_slice`. Thanks to specialization, this is no longer true.
32 pub EXTEND_FROM_SLICE,
33 "`.extend_from_slice(_)` is a faster way to extend a Vec by a slice"
36 declare_deprecated_lint! {
38 /// Nothing. This lint has been deprecated.
40 /// ### Deprecation reason
41 /// `Range::step_by(0)` used to be linted since it's
42 /// an infinite iterator, which is better expressed by `iter::repeat`,
43 /// but the method has been removed for `Iterator::step_by` which panics
45 pub RANGE_STEP_BY_ZERO,
46 "`iterator.step_by(0)` panics nowadays"
49 declare_deprecated_lint! {
51 /// Nothing. This lint has been deprecated.
53 /// ### Deprecation reason
54 /// This used to check for `Vec::as_slice`, which was unstable with good
55 /// stable alternatives. `Vec::as_slice` has now been stabilized.
56 pub UNSTABLE_AS_SLICE,
57 "`Vec::as_slice` has been stabilized in 1.7"
60 declare_deprecated_lint! {
62 /// Nothing. This lint has been deprecated.
64 /// ### Deprecation reason
65 /// This used to check for `Vec::as_mut_slice`, which was unstable with good
66 /// stable alternatives. `Vec::as_mut_slice` has now been stabilized.
67 pub UNSTABLE_AS_MUT_SLICE,
68 "`Vec::as_mut_slice` has been stabilized in 1.7"
71 declare_deprecated_lint! {
73 /// Nothing. This lint has been deprecated.
75 /// ### Deprecation reason
76 /// This lint should never have applied to non-pointer types, as transmuting
77 /// between non-pointer types of differing alignment is well-defined behavior (it's semantically
78 /// equivalent to a memcpy). This lint has thus been refactored into two separate lints:
79 /// cast_ptr_alignment and transmute_ptr_to_ptr.
80 pub MISALIGNED_TRANSMUTE,
81 "this lint has been split into cast_ptr_alignment and transmute_ptr_to_ptr"
84 declare_deprecated_lint! {
86 /// Nothing. This lint has been deprecated.
88 /// ### Deprecation reason
89 /// This lint is too subjective, not having a good reason for being in clippy.
90 /// Additionally, compound assignment operators may be overloaded separately from their non-assigning
91 /// counterparts, so this lint may suggest a change in behavior or the code may not compile.
93 "using compound assignment operators (e.g., `+=`) is harmless"
96 declare_deprecated_lint! {
98 /// Nothing. This lint has been deprecated.
100 /// ### Deprecation reason
101 /// The original rule will only lint for `if let`. After
102 /// making it support to lint `match`, naming as `if let` is not suitable for it.
103 /// So, this lint is deprecated.
104 pub IF_LET_REDUNDANT_PATTERN_MATCHING,
105 "this lint has been changed to redundant_pattern_matching"
108 declare_deprecated_lint! {
110 /// Nothing. This lint has been deprecated.
112 /// ### Deprecation reason
113 /// This lint used to suggest replacing `let mut vec =
114 /// Vec::with_capacity(n); vec.set_len(n);` with `let vec = vec![0; n];`. The
115 /// replacement has very different performance characteristics so the lint is
117 pub UNSAFE_VECTOR_INITIALIZATION,
118 "the replacement suggested by this lint had substantially different behavior"
121 declare_deprecated_lint! {
123 /// Nothing. This lint has been deprecated.
125 /// ### Deprecation reason
126 /// This lint has been superseded by #[must_use] in rustc.
128 "`collect` has been marked as #[must_use] in rustc and that covers all cases of this lint"
131 declare_deprecated_lint! {
133 /// Nothing. This lint has been deprecated.
135 /// ### Deprecation reason
136 /// Associated-constants are now preferred.
138 "associated-constants `MIN`/`MAX` of integers are preferred to `{min,max}_value()` and module constants"
141 declare_deprecated_lint! {
143 /// Nothing. This lint has been deprecated.
145 /// ### Deprecation reason
146 /// The regex! macro does not exist anymore.
148 "the regex! macro has been removed from the regex crate in 2018"
151 declare_deprecated_lint! {
153 /// Nothing. This lint has been deprecated.
155 /// ### Deprecation reason
156 /// This lint has been replaced by `manual_find_map`, a
157 /// more specific lint.
159 "this lint has been replaced by `manual_find_map`, a more specific lint"
162 declare_deprecated_lint! {
164 /// Nothing. This lint has been deprecated.
166 /// ### Deprecation reason
167 /// This lint has been replaced by `manual_filter_map`, a
168 /// more specific lint.
170 "this lint has been replaced by `manual_filter_map`, a more specific lint"
173 declare_deprecated_lint! {
175 /// Nothing. This lint has been deprecated.
177 /// ### Deprecation reason
178 /// The `avoid_breaking_exported_api` config option was added, which
179 /// enables the `enum_variant_names` lint for public items.
181 pub PUB_ENUM_VARIANT_NAMES,
182 "set the `avoid-breaking-exported-api` config option to `false` to enable the `enum_variant_names` lint for public items"
185 declare_deprecated_lint! {
187 /// Nothing. This lint has been deprecated.
189 /// ### Deprecation reason
190 /// The `avoid_breaking_exported_api` config option was added, which
191 /// enables the `wrong_self_conversion` lint for public items.
192 pub WRONG_PUB_SELF_CONVENTION,
193 "set the `avoid-breaking-exported-api` config option to `false` to enable the `wrong_self_convention` lint for public items"