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! {
15 /// **What it does:** Nothing. This lint has been deprecated.
17 /// **Deprecation reason:** This used to check for `assert!(a == b)` and recommend
18 /// replacement with `assert_eq!(a, b)`, but this is no longer needed after RFC 2011.
20 "`assert!()` will be more flexible with RFC 2011"
23 declare_deprecated_lint! {
24 /// **What it does:** Nothing. This lint has been deprecated.
26 /// **Deprecation reason:** This used to check for `Vec::extend`, which was slower than
27 /// `Vec::extend_from_slice`. Thanks to specialization, this is no longer true.
28 pub EXTEND_FROM_SLICE,
29 "`.extend_from_slice(_)` is a faster way to extend a Vec by a slice"
32 declare_deprecated_lint! {
33 /// **What it does:** Nothing. This lint has been deprecated.
35 /// **Deprecation reason:** `Range::step_by(0)` used to be linted since it's
36 /// an infinite iterator, which is better expressed by `iter::repeat`,
37 /// but the method has been removed for `Iterator::step_by` which panics
39 pub RANGE_STEP_BY_ZERO,
40 "`iterator.step_by(0)` panics nowadays"
43 declare_deprecated_lint! {
44 /// **What it does:** Nothing. This lint has been deprecated.
46 /// **Deprecation reason:** This used to check for `Vec::as_slice`, which was unstable with good
47 /// stable alternatives. `Vec::as_slice` has now been stabilized.
48 pub UNSTABLE_AS_SLICE,
49 "`Vec::as_slice` has been stabilized in 1.7"
52 declare_deprecated_lint! {
53 /// **What it does:** Nothing. This lint has been deprecated.
55 /// **Deprecation reason:** This used to check for `Vec::as_mut_slice`, which was unstable with good
56 /// stable alternatives. `Vec::as_mut_slice` has now been stabilized.
57 pub UNSTABLE_AS_MUT_SLICE,
58 "`Vec::as_mut_slice` has been stabilized in 1.7"
61 declare_deprecated_lint! {
62 /// **What it does:** Nothing. This lint has been deprecated.
64 /// **Deprecation reason:** This lint should never have applied to non-pointer types, as transmuting
65 /// between non-pointer types of differing alignment is well-defined behavior (it's semantically
66 /// equivalent to a memcpy). This lint has thus been refactored into two separate lints:
67 /// cast_ptr_alignment and transmute_ptr_to_ptr.
68 pub MISALIGNED_TRANSMUTE,
69 "this lint has been split into cast_ptr_alignment and transmute_ptr_to_ptr"
72 declare_deprecated_lint! {
73 /// **What it does:** Nothing. This lint has been deprecated.
75 /// **Deprecation reason:** This lint is too subjective, not having a good reason for being in clippy.
76 /// Additionally, compound assignment operators may be overloaded separately from their non-assigning
77 /// counterparts, so this lint may suggest a change in behavior or the code may not compile.
79 "using compound assignment operators (e.g., `+=`) is harmless"
82 declare_deprecated_lint! {
83 /// **What it does:** Nothing. This lint has been deprecated.
85 /// **Deprecation reason:** The original rule will only lint for `if let`. After
86 /// making it support to lint `match`, naming as `if let` is not suitable for it.
87 /// So, this lint is deprecated.
88 pub IF_LET_REDUNDANT_PATTERN_MATCHING,
89 "this lint has been changed to redundant_pattern_matching"
92 declare_deprecated_lint! {
93 /// **What it does:** Nothing. This lint has been deprecated.
95 /// **Deprecation reason:** This lint used to suggest replacing `let mut vec =
96 /// Vec::with_capacity(n); vec.set_len(n);` with `let vec = vec![0; n];`. The
97 /// replacement has very different performance characteristics so the lint is
99 pub UNSAFE_VECTOR_INITIALIZATION,
100 "the replacement suggested by this lint had substantially different behavior"
103 declare_deprecated_lint! {
104 /// **What it does:** Nothing. This lint has been deprecated.
106 /// **Deprecation reason:** This lint has been superseded by #[must_use] in rustc.
108 "`collect` has been marked as #[must_use] in rustc and that covers all cases of this lint"
111 declare_deprecated_lint! {
112 /// **What it does:** Nothing. This lint has been deprecated.
114 /// **Deprecation reason:** Associated-constants are now preferred.
116 "associated-constants `MIN`/`MAX` of integers are preferred to `{min,max}_value()` and module constants"
119 declare_deprecated_lint! {
120 /// **What it does:** Nothing. This lint has been deprecated.
122 /// **Deprecation reason:** The regex! macro does not exist anymore.
124 "the regex! macro has been removed from the regex crate in 2018"
127 declare_deprecated_lint! {
128 /// **What it does:** Nothing. This lint has been deprecated.
130 /// **Deprecation reason:** This lint has been replaced by `manual_find_map`, a
131 /// more specific lint.
133 "this lint has been replaced by `manual_find_map`, a more specific lint"
136 declare_deprecated_lint! {
137 /// **What it does:** Nothing. This lint has been deprecated.
139 /// **Deprecation reason:** This lint has been replaced by `manual_filter_map`, a
140 /// more specific lint.
142 "this lint has been replaced by `manual_filter_map`, a more specific lint"
145 declare_deprecated_lint! {
146 /// **What it does:** Nothing. This lint has been deprecated.
148 /// **Deprecation reason:** The `avoid_breaking_exported_api` config option was added, which
149 /// enables the `enum_variant_names` lint for public items.
151 pub PUB_ENUM_VARIANT_NAMES,
152 "set the `avoid-breaking-exported-api` config option to `false` to enable the `enum_variant_names` lint for public items"
155 declare_deprecated_lint! {
156 /// **What it does:** Nothing. This lint has been deprecated.
158 /// **Deprecation reason:** The `avoid_breaking_exported_api` config option was added, which
159 /// enables the `wrong_self_conversion` lint for public items.
160 pub WRONG_PUB_SELF_CONVENTION,
161 "set the `avoid-breaking-exported-api` config option to `false` to enable the `wrong_self_convention` lint for public items"