2016-03-24 18:25:59 +00:00
|
|
|
macro_rules! declare_deprecated_lint {
|
|
|
|
(pub $name: ident, $_reason: expr) => {
|
|
|
|
declare_lint!(pub $name, Allow, "deprecated lint")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-10-20 04:42:04 +00:00
|
|
|
declare_deprecated_lint! {
|
2019-11-02 18:10:59 +00:00
|
|
|
/// **What it does:** Nothing. This lint has been deprecated.
|
|
|
|
///
|
|
|
|
/// **Deprecation reason:** This used to check for `assert!(a == b)` and recommend
|
|
|
|
/// replacement with `assert_eq!(a, b)`, but this is no longer needed after RFC 2011.
|
2017-10-20 04:42:04 +00:00
|
|
|
pub SHOULD_ASSERT_EQ,
|
|
|
|
"`assert!()` will be more flexible with RFC 2011"
|
|
|
|
}
|
2017-01-14 13:39:41 +00:00
|
|
|
|
|
|
|
declare_deprecated_lint! {
|
2019-11-02 18:10:59 +00:00
|
|
|
/// **What it does:** Nothing. This lint has been deprecated.
|
|
|
|
///
|
|
|
|
/// **Deprecation reason:** This used to check for `Vec::extend`, which was slower than
|
|
|
|
/// `Vec::extend_from_slice`. Thanks to specialization, this is no longer true.
|
2017-01-14 13:39:41 +00:00
|
|
|
pub EXTEND_FROM_SLICE,
|
|
|
|
"`.extend_from_slice(_)` is a faster way to extend a Vec by a slice"
|
|
|
|
}
|
|
|
|
|
2017-06-18 13:14:46 +00:00
|
|
|
declare_deprecated_lint! {
|
2019-11-02 18:10:59 +00:00
|
|
|
/// **What it does:** Nothing. This lint has been deprecated.
|
|
|
|
///
|
|
|
|
/// **Deprecation reason:** `Range::step_by(0)` used to be linted since it's
|
|
|
|
/// an infinite iterator, which is better expressed by `iter::repeat`,
|
|
|
|
/// but the method has been removed for `Iterator::step_by` which panics
|
|
|
|
/// if given a zero
|
2017-06-18 13:14:46 +00:00
|
|
|
pub RANGE_STEP_BY_ZERO,
|
|
|
|
"`iterator.step_by(0)` panics nowadays"
|
|
|
|
}
|
2017-01-14 13:39:41 +00:00
|
|
|
|
2016-03-24 18:25:59 +00:00
|
|
|
declare_deprecated_lint! {
|
2019-11-02 18:10:59 +00:00
|
|
|
/// **What it does:** Nothing. This lint has been deprecated.
|
|
|
|
///
|
|
|
|
/// **Deprecation reason:** This used to check for `Vec::as_slice`, which was unstable with good
|
|
|
|
/// stable alternatives. `Vec::as_slice` has now been stabilized.
|
2016-03-24 18:25:59 +00:00
|
|
|
pub UNSTABLE_AS_SLICE,
|
|
|
|
"`Vec::as_slice` has been stabilized in 1.7"
|
|
|
|
}
|
|
|
|
|
|
|
|
declare_deprecated_lint! {
|
2019-11-02 18:10:59 +00:00
|
|
|
/// **What it does:** Nothing. This lint has been deprecated.
|
|
|
|
///
|
|
|
|
/// **Deprecation reason:** This used to check for `Vec::as_mut_slice`, which was unstable with good
|
|
|
|
/// stable alternatives. `Vec::as_mut_slice` has now been stabilized.
|
2016-03-24 18:25:59 +00:00
|
|
|
pub UNSTABLE_AS_MUT_SLICE,
|
|
|
|
"`Vec::as_mut_slice` has been stabilized in 1.7"
|
|
|
|
}
|
|
|
|
|
|
|
|
declare_deprecated_lint! {
|
2019-11-02 18:10:59 +00:00
|
|
|
/// **What it does:** Nothing. This lint has been deprecated.
|
|
|
|
///
|
|
|
|
/// **Deprecation reason:** This used to check for `.to_string()` method calls on values
|
|
|
|
/// of type `&str`. This is not unidiomatic and with specialization coming, `to_string` could be
|
|
|
|
/// specialized to be as efficient as `to_owned`.
|
2016-03-24 18:25:59 +00:00
|
|
|
pub STR_TO_STRING,
|
|
|
|
"using `str::to_string` is common even today and specialization will likely happen soon"
|
|
|
|
}
|
|
|
|
|
|
|
|
declare_deprecated_lint! {
|
2019-11-02 18:10:59 +00:00
|
|
|
/// **What it does:** Nothing. This lint has been deprecated.
|
|
|
|
///
|
|
|
|
/// **Deprecation reason:** This used to check for `.to_string()` method calls on values
|
|
|
|
/// of type `String`. This is not unidiomatic and with specialization coming, `to_string` could be
|
|
|
|
/// specialized to be as efficient as `clone`.
|
2016-03-24 18:25:59 +00:00
|
|
|
pub STRING_TO_STRING,
|
|
|
|
"using `string::to_string` is common even today and specialization will likely happen soon"
|
|
|
|
}
|
2018-04-11 09:50:04 +00:00
|
|
|
|
|
|
|
declare_deprecated_lint! {
|
2019-11-02 18:10:59 +00:00
|
|
|
/// **What it does:** Nothing. This lint has been deprecated.
|
|
|
|
///
|
|
|
|
/// **Deprecation reason:** This lint should never have applied to non-pointer types, as transmuting
|
|
|
|
/// between non-pointer types of differing alignment is well-defined behavior (it's semantically
|
|
|
|
/// equivalent to a memcpy). This lint has thus been refactored into two separate lints:
|
|
|
|
/// cast_ptr_alignment and transmute_ptr_to_ptr.
|
2018-04-11 09:50:04 +00:00
|
|
|
pub MISALIGNED_TRANSMUTE,
|
|
|
|
"this lint has been split into cast_ptr_alignment and transmute_ptr_to_ptr"
|
|
|
|
}
|
2018-08-09 19:14:12 +00:00
|
|
|
|
|
|
|
declare_deprecated_lint! {
|
2019-11-02 18:19:25 +00:00
|
|
|
/// **What it does:** Nothing. This lint has been deprecated.
|
|
|
|
///
|
|
|
|
/// **Deprecation reason:** This lint is too subjective, not having a good reason for being in clippy.
|
|
|
|
/// Additionally, compound assignment operators may be overloaded separately from their non-assigning
|
|
|
|
/// counterparts, so this lint may suggest a change in behavior or the code may not compile.
|
2018-08-09 19:14:12 +00:00
|
|
|
pub ASSIGN_OPS,
|
2019-01-31 01:15:29 +00:00
|
|
|
"using compound assignment operators (e.g., `+=`) is harmless"
|
2018-08-09 19:14:12 +00:00
|
|
|
}
|
2018-10-10 15:13:53 +00:00
|
|
|
|
|
|
|
declare_deprecated_lint! {
|
2019-11-02 18:10:59 +00:00
|
|
|
/// **What it does:** Nothing. This lint has been deprecated.
|
|
|
|
///
|
|
|
|
/// **Deprecation reason:** The original rule will only lint for `if let`. After
|
|
|
|
/// making it support to lint `match`, naming as `if let` is not suitable for it.
|
|
|
|
/// So, this lint is deprecated.
|
2018-10-10 15:13:53 +00:00
|
|
|
pub IF_LET_REDUNDANT_PATTERN_MATCHING,
|
|
|
|
"this lint has been changed to redundant_pattern_matching"
|
|
|
|
}
|
2018-12-03 10:43:01 +00:00
|
|
|
|
|
|
|
declare_deprecated_lint! {
|
2019-11-02 18:10:59 +00:00
|
|
|
/// **What it does:** Nothing. This lint has been deprecated.
|
|
|
|
///
|
|
|
|
/// **Deprecation reason:** This lint used to suggest replacing `let mut vec =
|
|
|
|
/// Vec::with_capacity(n); vec.set_len(n);` with `let vec = vec![0; n];`. The
|
|
|
|
/// replacement has very different performance characteristics so the lint is
|
|
|
|
/// deprecated.
|
2018-12-03 10:43:01 +00:00
|
|
|
pub UNSAFE_VECTOR_INITIALIZATION,
|
|
|
|
"the replacement suggested by this lint had substantially different behavior"
|
|
|
|
}
|
2019-08-11 07:30:20 +00:00
|
|
|
|
2019-08-12 05:27:01 +00:00
|
|
|
declare_deprecated_lint! {
|
2019-11-02 18:10:59 +00:00
|
|
|
/// **What it does:** Nothing. This lint has been deprecated.
|
|
|
|
///
|
|
|
|
/// **Deprecation reason:** This lint has been superseded by the warn-by-default
|
|
|
|
/// `invalid_value` rustc lint.
|
2019-08-11 07:30:20 +00:00
|
|
|
pub INVALID_REF,
|
|
|
|
"superseded by rustc lint `invalid_value`"
|
|
|
|
}
|
2019-08-07 05:37:13 +00:00
|
|
|
|
|
|
|
declare_deprecated_lint! {
|
2019-11-02 18:10:59 +00:00
|
|
|
/// **What it does:** Nothing. This lint has been deprecated.
|
|
|
|
///
|
|
|
|
/// **Deprecation reason:** This lint has been superseded by #[must_use] in rustc.
|
2019-08-07 05:37:13 +00:00
|
|
|
pub UNUSED_COLLECT,
|
|
|
|
"`collect` has been marked as #[must_use] in rustc and that covers all cases of this lint"
|
|
|
|
}
|
2019-11-07 12:44:57 +00:00
|
|
|
|
|
|
|
declare_deprecated_lint! {
|
|
|
|
/// **What it does:** Nothing. This lint has been deprecated.
|
|
|
|
///
|
|
|
|
/// **Deprecation reason:** This lint has been uplifted to rustc and is now called
|
|
|
|
/// `array_into_iter`.
|
|
|
|
pub INTO_ITER_ON_ARRAY,
|
|
|
|
"this lint has been uplifted to rustc and is now called `array_into_iter`"
|
|
|
|
}
|
2019-12-21 15:20:30 +00:00
|
|
|
|
|
|
|
declare_deprecated_lint! {
|
|
|
|
/// **What it does:** Nothing. This lint has been deprecated.
|
|
|
|
///
|
|
|
|
/// **Deprecation reason:** This lint has been uplifted to rustc and is now called
|
|
|
|
/// `unused_labels`.
|
|
|
|
pub UNUSED_LABEL,
|
|
|
|
"this lint has been uplifted to rustc and is now called `unused_labels`"
|
|
|
|
}
|
2020-03-29 05:59:35 +00:00
|
|
|
|
|
|
|
declare_deprecated_lint! {
|
|
|
|
/// **What it does:** Nothing. This lint has been deprecated.
|
|
|
|
///
|
|
|
|
/// **Deprecation reason:** Associated-constants are now preferred.
|
|
|
|
pub REPLACE_CONSTS,
|
|
|
|
"associated-constants `MIN`/`MAX` of integers are prefer to `{min,max}_value()` and module constants"
|
|
|
|
}
|