]> git.proxmox.com Git - rustc.git/blob - src/tools/clippy/clippy_lints/src/deprecated_lints.rs
New upstream version 1.23.0+dfsg1
[rustc.git] / src / tools / clippy / clippy_lints / src / deprecated_lints.rs
1 macro_rules! declare_deprecated_lint {
2 (pub $name: ident, $_reason: expr) => {
3 declare_lint!(pub $name, Allow, "deprecated lint")
4 }
5 }
6
7 /// **What it does:** Nothing. This lint has been deprecated.
8 ///
9 /// **Deprecation reason:** This used to check for `assert!(a == b)` and recommend
10 /// replacement with `assert_eq!(a, b)`, but this is no longer needed after RFC 2011.
11 declare_deprecated_lint! {
12 pub SHOULD_ASSERT_EQ,
13 "`assert!()` will be more flexible with RFC 2011"
14 }
15
16 /// **What it does:** Nothing. This lint has been deprecated.
17 ///
18 /// **Deprecation reason:** This used to check for `Vec::extend`, which was slower than
19 /// `Vec::extend_from_slice`. Thanks to specialization, this is no longer true.
20 declare_deprecated_lint! {
21 pub EXTEND_FROM_SLICE,
22 "`.extend_from_slice(_)` is a faster way to extend a Vec by a slice"
23 }
24
25 /// **What it does:** Nothing. This lint has been deprecated.
26 ///
27 /// **Deprecation reason:** `Range::step_by(0)` used to be linted since it's
28 /// an infinite iterator, which is better expressed by `iter::repeat`,
29 /// but the method has been removed for `Iterator::step_by` which panics
30 /// if given a zero
31 declare_deprecated_lint! {
32 pub RANGE_STEP_BY_ZERO,
33 "`iterator.step_by(0)` panics nowadays"
34 }
35
36 /// **What it does:** Nothing. This lint has been deprecated.
37 ///
38 /// **Deprecation reason:** This used to check for `Vec::as_slice`, which was unstable with good
39 /// stable alternatives. `Vec::as_slice` has now been stabilized.
40 declare_deprecated_lint! {
41 pub UNSTABLE_AS_SLICE,
42 "`Vec::as_slice` has been stabilized in 1.7"
43 }
44
45
46 /// **What it does:** Nothing. This lint has been deprecated.
47 ///
48 /// **Deprecation reason:** This used to check for `Vec::as_mut_slice`, which was unstable with good
49 /// stable alternatives. `Vec::as_mut_slice` has now been stabilized.
50 declare_deprecated_lint! {
51 pub UNSTABLE_AS_MUT_SLICE,
52 "`Vec::as_mut_slice` has been stabilized in 1.7"
53 }
54
55 /// **What it does:** Nothing. This lint has been deprecated.
56 ///
57 /// **Deprecation reason:** This used to check for `.to_string()` method calls on values
58 /// of type `&str`. This is not unidiomatic and with specialization coming, `to_string` could be
59 /// specialized to be as efficient as `to_owned`.
60 declare_deprecated_lint! {
61 pub STR_TO_STRING,
62 "using `str::to_string` is common even today and specialization will likely happen soon"
63 }
64
65 /// **What it does:** Nothing. This lint has been deprecated.
66 ///
67 /// **Deprecation reason:** This used to check for `.to_string()` method calls on values
68 /// of type `String`. This is not unidiomatic and with specialization coming, `to_string` could be
69 /// specialized to be as efficient as `clone`.
70 declare_deprecated_lint! {
71 pub STRING_TO_STRING,
72 "using `string::to_string` is common even today and specialization will likely happen soon"
73 }