Skip to content

Commit 53a99cd

Browse files
authored
Rollup merge of rust-lang#4757 - evanjs:issue/4748, r=phansch
Fix Deprecated lints don't expand ### Move doc comments inside of declare_deprecated_lint macros so that they are picked up by lintlib.py ### fixes rust-lang#4748 Unable to `cargo test` locally (I'm on NixOS, and keep getting errors that are similar to those rust-lang#4714 might solve) but I have verified that all deprecated lints can now be expanded like other lints. ![2019-10-30_21:06:28](https://user-images.githubusercontent.com/1847524/67910501-5815de00-fb59-11e9-9fa2-91fe6a8b9bb9.png) changelog: Show deprecated lints in lint documentation again
2 parents da14c8d + 8ca9c23 commit 53a99cd

File tree

1 file changed

+61
-62
lines changed

1 file changed

+61
-62
lines changed

clippy_lints/src/deprecated_lints.rs

+61-62
Original file line numberDiff line numberDiff line change
@@ -4,129 +4,128 @@ macro_rules! declare_deprecated_lint {
44
}
55
}
66

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.
117
declare_deprecated_lint! {
8+
/// **What it does:** Nothing. This lint has been deprecated.
9+
///
10+
/// **Deprecation reason:** This used to check for `assert!(a == b)` and recommend
11+
/// replacement with `assert_eq!(a, b)`, but this is no longer needed after RFC 2011.
1212
pub SHOULD_ASSERT_EQ,
1313
"`assert!()` will be more flexible with RFC 2011"
1414
}
1515

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.
2016
declare_deprecated_lint! {
17+
/// **What it does:** Nothing. This lint has been deprecated.
18+
///
19+
/// **Deprecation reason:** This used to check for `Vec::extend`, which was slower than
20+
/// `Vec::extend_from_slice`. Thanks to specialization, this is no longer true.
2121
pub EXTEND_FROM_SLICE,
2222
"`.extend_from_slice(_)` is a faster way to extend a Vec by a slice"
2323
}
2424

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
3125
declare_deprecated_lint! {
26+
/// **What it does:** Nothing. This lint has been deprecated.
27+
///
28+
/// **Deprecation reason:** `Range::step_by(0)` used to be linted since it's
29+
/// an infinite iterator, which is better expressed by `iter::repeat`,
30+
/// but the method has been removed for `Iterator::step_by` which panics
31+
/// if given a zero
3232
pub RANGE_STEP_BY_ZERO,
3333
"`iterator.step_by(0)` panics nowadays"
3434
}
3535

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.
4036
declare_deprecated_lint! {
37+
/// **What it does:** Nothing. This lint has been deprecated.
38+
///
39+
/// **Deprecation reason:** This used to check for `Vec::as_slice`, which was unstable with good
40+
/// stable alternatives. `Vec::as_slice` has now been stabilized.
4141
pub UNSTABLE_AS_SLICE,
4242
"`Vec::as_slice` has been stabilized in 1.7"
4343
}
4444

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.
5045
declare_deprecated_lint! {
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.
5150
pub UNSTABLE_AS_MUT_SLICE,
5251
"`Vec::as_mut_slice` has been stabilized in 1.7"
5352
}
5453

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`.
6054
declare_deprecated_lint! {
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`.
6160
pub STR_TO_STRING,
6261
"using `str::to_string` is common even today and specialization will likely happen soon"
6362
}
6463

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`.
7064
declare_deprecated_lint! {
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`.
7170
pub STRING_TO_STRING,
7271
"using `string::to_string` is common even today and specialization will likely happen soon"
7372
}
7473

75-
/// **What it does:** Nothing. This lint has been deprecated.
76-
///
77-
/// **Deprecation reason:** This lint should never have applied to non-pointer types, as transmuting
78-
/// between non-pointer types of differing alignment is well-defined behavior (it's semantically
79-
/// equivalent to a memcpy). This lint has thus been refactored into two separate lints:
80-
/// cast_ptr_alignment and transmute_ptr_to_ptr.
8174
declare_deprecated_lint! {
75+
/// **What it does:** Nothing. This lint has been deprecated.
76+
///
77+
/// **Deprecation reason:** This lint should never have applied to non-pointer types, as transmuting
78+
/// between non-pointer types of differing alignment is well-defined behavior (it's semantically
79+
/// equivalent to a memcpy). This lint has thus been refactored into two separate lints:
80+
/// cast_ptr_alignment and transmute_ptr_to_ptr.
8281
pub MISALIGNED_TRANSMUTE,
8382
"this lint has been split into cast_ptr_alignment and transmute_ptr_to_ptr"
8483
}
8584

86-
/// **What it does:** Nothing. This lint has been deprecated.
87-
///
88-
/// **Deprecation reason:** This lint is too subjective, not having a good reason for being in clippy.
89-
/// Additionally, compound assignment operators may be overloaded separately from their non-assigning
90-
/// counterparts, so this lint may suggest a change in behavior or the code may not compile.
9185
declare_deprecated_lint! {
86+
/// **What it does:** Nothing. This lint has been deprecated.
87+
///
88+
/// **Deprecation reason:** This lint is too subjective, not having a good reason for being in clippy.
89+
/// Additionally, compound assignment operators may be overloaded separately from their non-assigning
90+
/// counterparts, so this lint may suggest a change in behavior or the code may not compile.
9291
pub ASSIGN_OPS,
9392
"using compound assignment operators (e.g., `+=`) is harmless"
9493
}
9594

96-
/// **What it does:** Nothing. This lint has been deprecated.
97-
///
98-
/// **Deprecation reason:** The original rule will only lint for `if let`. After
99-
/// making it support to lint `match`, naming as `if let` is not suitable for it.
100-
/// So, this lint is deprecated.
10195
declare_deprecated_lint! {
96+
/// **What it does:** Nothing. This lint has been deprecated.
97+
///
98+
/// **Deprecation reason:** The original rule will only lint for `if let`. After
99+
/// making it support to lint `match`, naming as `if let` is not suitable for it.
100+
/// So, this lint is deprecated.
102101
pub IF_LET_REDUNDANT_PATTERN_MATCHING,
103102
"this lint has been changed to redundant_pattern_matching"
104103
}
105104

106-
/// **What it does:** Nothing. This lint has been deprecated.
107-
///
108-
/// **Deprecation reason:** This lint used to suggest replacing `let mut vec =
109-
/// Vec::with_capacity(n); vec.set_len(n);` with `let vec = vec![0; n];`. The
110-
/// replacement has very different performance characteristics so the lint is
111-
/// deprecated.
112105
declare_deprecated_lint! {
106+
/// **What it does:** Nothing. This lint has been deprecated.
107+
///
108+
/// **Deprecation reason:** This lint used to suggest replacing `let mut vec =
109+
/// Vec::with_capacity(n); vec.set_len(n);` with `let vec = vec![0; n];`. The
110+
/// replacement has very different performance characteristics so the lint is
111+
/// deprecated.
113112
pub UNSAFE_VECTOR_INITIALIZATION,
114113
"the replacement suggested by this lint had substantially different behavior"
115114
}
116115

117-
/// **What it does:** Nothing. This lint has been deprecated.
118-
///
119-
/// **Deprecation reason:** This lint has been superseded by the warn-by-default
120-
/// `invalid_value` rustc lint.
121116
declare_deprecated_lint! {
117+
/// **What it does:** Nothing. This lint has been deprecated.
118+
///
119+
/// **Deprecation reason:** This lint has been superseded by the warn-by-default
120+
/// `invalid_value` rustc lint.
122121
pub INVALID_REF,
123122
"superseded by rustc lint `invalid_value`"
124123
}
125124

126-
/// **What it does:** Nothing. This lint has been deprecated.
127-
///
128-
/// **Deprecation reason:** This lint has been superseded by #[must_use] in rustc.
129125
declare_deprecated_lint! {
126+
/// **What it does:** Nothing. This lint has been deprecated.
127+
///
128+
/// **Deprecation reason:** This lint has been superseded by #[must_use] in rustc.
130129
pub UNUSED_COLLECT,
131130
"`collect` has been marked as #[must_use] in rustc and that covers all cases of this lint"
132131
}

0 commit comments

Comments
 (0)