1 // NOTE: if you add a deprecated lint in this file, please add a corresponding test in
2 // tests/ui/deprecated.rs
4 /// This struct fakes the `Lint` declaration that is usually created by `declare_lint!`. This
5 /// enables the simple extraction of the metadata without changing the current deprecation
7 pub struct ClippyDeprecatedLint;
9 macro_rules! declare_deprecated_lint {
10 { $(#[$attr:meta])* pub $name: ident, $_reason: expr} => {
13 pub static $name: ClippyDeprecatedLint = ClippyDeprecatedLint {};
17 declare_deprecated_lint! {
19 /// Nothing. This lint has been deprecated.
21 /// ### Deprecation reason
22 /// This used to check for `assert!(a == b)` and recommend
23 /// replacement with `assert_eq!(a, b)`, but this is no longer needed after RFC 2011.
25 "`assert!()` will be more flexible with RFC 2011"
28 declare_deprecated_lint! {
30 /// Nothing. This lint has been deprecated.
32 /// ### Deprecation reason
33 /// This used to check for `Vec::extend`, which was slower than
34 /// `Vec::extend_from_slice`. Thanks to specialization, this is no longer true.
35 pub EXTEND_FROM_SLICE,
36 "`.extend_from_slice(_)` is a faster way to extend a Vec by a slice"
39 declare_deprecated_lint! {
41 /// Nothing. This lint has been deprecated.
43 /// ### Deprecation reason
44 /// `Range::step_by(0)` used to be linted since it's
45 /// an infinite iterator, which is better expressed by `iter::repeat`,
46 /// but the method has been removed for `Iterator::step_by` which panics
48 pub RANGE_STEP_BY_ZERO,
49 "`iterator.step_by(0)` panics nowadays"
52 declare_deprecated_lint! {
54 /// Nothing. This lint has been deprecated.
56 /// ### Deprecation reason
57 /// This used to check for `Vec::as_slice`, which was unstable with good
58 /// stable alternatives. `Vec::as_slice` has now been stabilized.
59 pub UNSTABLE_AS_SLICE,
60 "`Vec::as_slice` has been stabilized in 1.7"
63 declare_deprecated_lint! {
65 /// Nothing. This lint has been deprecated.
67 /// ### Deprecation reason
68 /// This used to check for `Vec::as_mut_slice`, which was unstable with good
69 /// stable alternatives. `Vec::as_mut_slice` has now been stabilized.
70 pub UNSTABLE_AS_MUT_SLICE,
71 "`Vec::as_mut_slice` has been stabilized in 1.7"
74 declare_deprecated_lint! {
76 /// Nothing. This lint has been deprecated.
78 /// ### Deprecation reason
79 /// This lint should never have applied to non-pointer types, as transmuting
80 /// between non-pointer types of differing alignment is well-defined behavior (it's semantically
81 /// equivalent to a memcpy). This lint has thus been refactored into two separate lints:
82 /// cast_ptr_alignment and transmute_ptr_to_ptr.
83 pub MISALIGNED_TRANSMUTE,
84 "this lint has been split into cast_ptr_alignment and transmute_ptr_to_ptr"
87 declare_deprecated_lint! {
89 /// Nothing. This lint has been deprecated.
91 /// ### Deprecation reason
92 /// This lint is too subjective, not having a good reason for being in clippy.
93 /// Additionally, compound assignment operators may be overloaded separately from their non-assigning
94 /// counterparts, so this lint may suggest a change in behavior or the code may not compile.
96 "using compound assignment operators (e.g., `+=`) is harmless"
99 declare_deprecated_lint! {
101 /// Nothing. This lint has been deprecated.
103 /// ### Deprecation reason
104 /// The original rule will only lint for `if let`. After
105 /// making it support to lint `match`, naming as `if let` is not suitable for it.
106 /// So, this lint is deprecated.
107 pub IF_LET_REDUNDANT_PATTERN_MATCHING,
108 "this lint has been changed to redundant_pattern_matching"
111 declare_deprecated_lint! {
113 /// Nothing. This lint has been deprecated.
115 /// ### Deprecation reason
116 /// This lint used to suggest replacing `let mut vec =
117 /// Vec::with_capacity(n); vec.set_len(n);` with `let vec = vec![0; n];`. The
118 /// replacement has very different performance characteristics so the lint is
120 pub UNSAFE_VECTOR_INITIALIZATION,
121 "the replacement suggested by this lint had substantially different behavior"
124 declare_deprecated_lint! {
126 /// Nothing. This lint has been deprecated.
128 /// ### Deprecation reason
129 /// This lint has been superseded by #[must_use] in rustc.
131 "`collect` has been marked as #[must_use] in rustc and that covers all cases of this lint"
134 declare_deprecated_lint! {
136 /// Nothing. This lint has been deprecated.
138 /// ### Deprecation reason
139 /// Associated-constants are now preferred.
141 "associated-constants `MIN`/`MAX` of integers are preferred to `{min,max}_value()` and module constants"
144 declare_deprecated_lint! {
146 /// Nothing. This lint has been deprecated.
148 /// ### Deprecation reason
149 /// The regex! macro does not exist anymore.
151 "the regex! macro has been removed from the regex crate in 2018"
154 declare_deprecated_lint! {
156 /// Nothing. This lint has been deprecated.
158 /// ### Deprecation reason
159 /// This lint has been replaced by `manual_find_map`, a
160 /// more specific lint.
162 "this lint has been replaced by `manual_find_map`, a more specific lint"
165 declare_deprecated_lint! {
167 /// Nothing. This lint has been deprecated.
169 /// ### Deprecation reason
170 /// This lint has been replaced by `manual_filter_map`, a
171 /// more specific lint.
173 "this lint has been replaced by `manual_filter_map`, a more specific lint"
176 declare_deprecated_lint! {
178 /// Nothing. This lint has been deprecated.
180 /// ### Deprecation reason
181 /// The `avoid_breaking_exported_api` config option was added, which
182 /// enables the `enum_variant_names` lint for public items.
184 pub PUB_ENUM_VARIANT_NAMES,
185 "set the `avoid-breaking-exported-api` config option to `false` to enable the `enum_variant_names` lint for public items"
188 declare_deprecated_lint! {
190 /// Nothing. This lint has been deprecated.
192 /// ### Deprecation reason
193 /// The `avoid_breaking_exported_api` config option was added, which
194 /// enables the `wrong_self_conversion` lint for public items.
195 pub WRONG_PUB_SELF_CONVENTION,
196 "set the `avoid-breaking-exported-api` config option to `false` to enable the `wrong_self_convention` lint for public items"