Skip to content

Commit 3c5e68d

Browse files
committed
Auto merge of #87962 - flip1995:clippy_backport, r=Mark-Simulacrum
[beta] Backport renaming of lints Backport renaming of 2 lints that were "wrongly" named. This is so that we don't have to go through the lint renaming process, if those lints would hit stable like this.
2 parents 53fd98c + c89c257 commit 3c5e68d

15 files changed

+34
-34
lines changed

src/tools/clippy/CHANGELOG.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -2423,7 +2423,6 @@ Released 2018-09-13
24232423
<!-- begin autogenerated links to lint list -->
24242424
[`absurd_extreme_comparisons`]: https://rust-lang.github.io/rust-clippy/master/index.html#absurd_extreme_comparisons
24252425
[`almost_swapped`]: https://rust-lang.github.io/rust-clippy/master/index.html#almost_swapped
2426-
[`append_instead_of_extend`]: https://rust-lang.github.io/rust-clippy/master/index.html#append_instead_of_extend
24272426
[`approx_constant`]: https://rust-lang.github.io/rust-clippy/master/index.html#approx_constant
24282427
[`as_conversions`]: https://rust-lang.github.io/rust-clippy/master/index.html#as_conversions
24292428
[`assertions_on_constants`]: https://rust-lang.github.io/rust-clippy/master/index.html#assertions_on_constants
@@ -2522,6 +2521,7 @@ Released 2018-09-13
25222521
[`explicit_iter_loop`]: https://rust-lang.github.io/rust-clippy/master/index.html#explicit_iter_loop
25232522
[`explicit_write`]: https://rust-lang.github.io/rust-clippy/master/index.html#explicit_write
25242523
[`extend_from_slice`]: https://rust-lang.github.io/rust-clippy/master/index.html#extend_from_slice
2524+
[`extend_with_drain`]: https://rust-lang.github.io/rust-clippy/master/index.html#extend_with_drain
25252525
[`extra_unused_lifetimes`]: https://rust-lang.github.io/rust-clippy/master/index.html#extra_unused_lifetimes
25262526
[`fallible_impl_from`]: https://rust-lang.github.io/rust-clippy/master/index.html#fallible_impl_from
25272527
[`field_reassign_with_default`]: https://rust-lang.github.io/rust-clippy/master/index.html#field_reassign_with_default
@@ -2772,7 +2772,7 @@ Released 2018-09-13
27722772
[`same_item_push`]: https://rust-lang.github.io/rust-clippy/master/index.html#same_item_push
27732773
[`search_is_some`]: https://rust-lang.github.io/rust-clippy/master/index.html#search_is_some
27742774
[`self_assignment`]: https://rust-lang.github.io/rust-clippy/master/index.html#self_assignment
2775-
[`self_named_constructor`]: https://rust-lang.github.io/rust-clippy/master/index.html#self_named_constructor
2775+
[`self_named_constructors`]: https://rust-lang.github.io/rust-clippy/master/index.html#self_named_constructors
27762776
[`semicolon_if_nothing_returned`]: https://rust-lang.github.io/rust-clippy/master/index.html#semicolon_if_nothing_returned
27772777
[`serde_api_misuse`]: https://rust-lang.github.io/rust-clippy/master/index.html#serde_api_misuse
27782778
[`shadow_reuse`]: https://rust-lang.github.io/rust-clippy/master/index.html#shadow_reuse

src/tools/clippy/clippy_lints/src/lib.rs

+8-8
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,7 @@ mod regex;
330330
mod repeat_once;
331331
mod returns;
332332
mod self_assignment;
333-
mod self_named_constructor;
333+
mod self_named_constructors;
334334
mod semicolon_if_nothing_returned;
335335
mod serde_api;
336336
mod shadow;
@@ -741,7 +741,6 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
741741
mem_replace::MEM_REPLACE_OPTION_WITH_NONE,
742742
mem_replace::MEM_REPLACE_WITH_DEFAULT,
743743
mem_replace::MEM_REPLACE_WITH_UNINIT,
744-
methods::APPEND_INSTEAD_OF_EXTEND,
745744
methods::BIND_INSTEAD_OF_MAP,
746745
methods::BYTES_NTH,
747746
methods::CHARS_LAST_CMP,
@@ -752,6 +751,7 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
752751
methods::CLONE_ON_REF_PTR,
753752
methods::EXPECT_FUN_CALL,
754753
methods::EXPECT_USED,
754+
methods::EXTEND_WITH_DRAIN,
755755
methods::FILETYPE_IS_FILE,
756756
methods::FILTER_MAP_IDENTITY,
757757
methods::FILTER_MAP_NEXT,
@@ -901,7 +901,7 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
901901
returns::LET_AND_RETURN,
902902
returns::NEEDLESS_RETURN,
903903
self_assignment::SELF_ASSIGNMENT,
904-
self_named_constructor::SELF_NAMED_CONSTRUCTOR,
904+
self_named_constructors::SELF_NAMED_CONSTRUCTORS,
905905
semicolon_if_nothing_returned::SEMICOLON_IF_NOTHING_RETURNED,
906906
serde_api::SERDE_API_MISUSE,
907907
shadow::SHADOW_REUSE,
@@ -1297,14 +1297,14 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
12971297
LintId::of(mem_replace::MEM_REPLACE_OPTION_WITH_NONE),
12981298
LintId::of(mem_replace::MEM_REPLACE_WITH_DEFAULT),
12991299
LintId::of(mem_replace::MEM_REPLACE_WITH_UNINIT),
1300-
LintId::of(methods::APPEND_INSTEAD_OF_EXTEND),
13011300
LintId::of(methods::BIND_INSTEAD_OF_MAP),
13021301
LintId::of(methods::BYTES_NTH),
13031302
LintId::of(methods::CHARS_LAST_CMP),
13041303
LintId::of(methods::CHARS_NEXT_CMP),
13051304
LintId::of(methods::CLONE_DOUBLE_REF),
13061305
LintId::of(methods::CLONE_ON_COPY),
13071306
LintId::of(methods::EXPECT_FUN_CALL),
1307+
LintId::of(methods::EXTEND_WITH_DRAIN),
13081308
LintId::of(methods::FILTER_MAP_IDENTITY),
13091309
LintId::of(methods::FILTER_NEXT),
13101310
LintId::of(methods::FLAT_MAP_IDENTITY),
@@ -1408,7 +1408,7 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
14081408
LintId::of(returns::LET_AND_RETURN),
14091409
LintId::of(returns::NEEDLESS_RETURN),
14101410
LintId::of(self_assignment::SELF_ASSIGNMENT),
1411-
LintId::of(self_named_constructor::SELF_NAMED_CONSTRUCTOR),
1411+
LintId::of(self_named_constructors::SELF_NAMED_CONSTRUCTORS),
14121412
LintId::of(serde_api::SERDE_API_MISUSE),
14131413
LintId::of(single_component_path_imports::SINGLE_COMPONENT_PATH_IMPORTS),
14141414
LintId::of(size_of_in_element_count::SIZE_OF_IN_ELEMENT_COUNT),
@@ -1562,7 +1562,7 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
15621562
LintId::of(redundant_static_lifetimes::REDUNDANT_STATIC_LIFETIMES),
15631563
LintId::of(returns::LET_AND_RETURN),
15641564
LintId::of(returns::NEEDLESS_RETURN),
1565-
LintId::of(self_named_constructor::SELF_NAMED_CONSTRUCTOR),
1565+
LintId::of(self_named_constructors::SELF_NAMED_CONSTRUCTORS),
15661566
LintId::of(single_component_path_imports::SINGLE_COMPONENT_PATH_IMPORTS),
15671567
LintId::of(tabs_in_doc_comments::TABS_IN_DOC_COMMENTS),
15681568
LintId::of(to_digit_is_some::TO_DIGIT_IS_SOME),
@@ -1763,8 +1763,8 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
17631763
LintId::of(large_enum_variant::LARGE_ENUM_VARIANT),
17641764
LintId::of(loops::MANUAL_MEMCPY),
17651765
LintId::of(loops::NEEDLESS_COLLECT),
1766-
LintId::of(methods::APPEND_INSTEAD_OF_EXTEND),
17671766
LintId::of(methods::EXPECT_FUN_CALL),
1767+
LintId::of(methods::EXTEND_WITH_DRAIN),
17681768
LintId::of(methods::ITER_NTH),
17691769
LintId::of(methods::MANUAL_STR_REPEAT),
17701770
LintId::of(methods::OR_FUN_CALL),
@@ -2105,7 +2105,7 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
21052105
let scripts = conf.allowed_scripts.clone();
21062106
store.register_early_pass(move || box disallowed_script_idents::DisallowedScriptIdents::new(&scripts));
21072107
store.register_late_pass(|| box strlen_on_c_strings::StrlenOnCStrings);
2108-
store.register_late_pass(move || box self_named_constructor::SelfNamedConstructor);
2108+
store.register_late_pass(move || box self_named_constructors::SelfNamedConstructors);
21092109
}
21102110

21112111
#[rustfmt::skip]

src/tools/clippy/clippy_lints/src/methods/append_instead_of_extend.rs renamed to src/tools/clippy/clippy_lints/src/methods/extend_with_drain.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use rustc_hir::{Expr, ExprKind, LangItem};
77
use rustc_lint::LateContext;
88
use rustc_span::symbol::sym;
99

10-
use super::APPEND_INSTEAD_OF_EXTEND;
10+
use super::EXTEND_WITH_DRAIN;
1111

1212
pub(super) fn check(cx: &LateContext<'_>, expr: &Expr<'_>, recv: &Expr<'_>, arg: &Expr<'_>) {
1313
let ty = cx.typeck_results().expr_ty(recv).peel_refs();
@@ -25,7 +25,7 @@ pub(super) fn check(cx: &LateContext<'_>, expr: &Expr<'_>, recv: &Expr<'_>, arg:
2525
let mut applicability = Applicability::MachineApplicable;
2626
span_lint_and_sugg(
2727
cx,
28-
APPEND_INSTEAD_OF_EXTEND,
28+
EXTEND_WITH_DRAIN,
2929
expr.span,
3030
"use of `extend` instead of `append` for adding the full range of a second vector",
3131
"try this",

src/tools/clippy/clippy_lints/src/methods/mod.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
mod append_instead_of_extend;
21
mod bind_instead_of_map;
32
mod bytes_nth;
43
mod chars_cmp;
@@ -12,6 +11,7 @@ mod clone_on_ref_ptr;
1211
mod cloned_instead_of_copied;
1312
mod expect_fun_call;
1413
mod expect_used;
14+
mod extend_with_drain;
1515
mod filetype_is_file;
1616
mod filter_map;
1717
mod filter_map_identity;
@@ -1052,7 +1052,7 @@ declare_clippy_lint! {
10521052
/// // Good
10531053
/// a.append(&mut b);
10541054
/// ```
1055-
pub APPEND_INSTEAD_OF_EXTEND,
1055+
pub EXTEND_WITH_DRAIN,
10561056
perf,
10571057
"using vec.append(&mut vec) to move the full range of a vecor to another"
10581058
}
@@ -1811,7 +1811,7 @@ impl_lint_pass!(Methods => [
18111811
IMPLICIT_CLONE,
18121812
SUSPICIOUS_SPLITN,
18131813
MANUAL_STR_REPEAT,
1814-
APPEND_INSTEAD_OF_EXTEND
1814+
EXTEND_WITH_DRAIN
18151815
]);
18161816

18171817
/// Extracts a method call name, args, and `Span` of the method name.
@@ -2075,7 +2075,7 @@ fn check_methods<'tcx>(cx: &LateContext<'tcx>, expr: &'tcx Expr<'_>, msrv: Optio
20752075
},
20762076
("extend", [arg]) => {
20772077
string_extend_chars::check(cx, expr, recv, arg);
2078-
append_instead_of_extend::check(cx, expr, recv, arg);
2078+
extend_with_drain::check(cx, expr, recv, arg);
20792079
},
20802080
("filter_map", [arg]) => {
20812081
unnecessary_filter_map::check(cx, expr, arg);

src/tools/clippy/clippy_lints/src/self_named_constructor.rs renamed to src/tools/clippy/clippy_lints/src/self_named_constructors.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,14 @@ declare_clippy_lint! {
3333
/// }
3434
/// }
3535
/// ```
36-
pub SELF_NAMED_CONSTRUCTOR,
36+
pub SELF_NAMED_CONSTRUCTORS,
3737
style,
3838
"method should not have the same name as the type it is implemented for"
3939
}
4040

41-
declare_lint_pass!(SelfNamedConstructor => [SELF_NAMED_CONSTRUCTOR]);
41+
declare_lint_pass!(SelfNamedConstructors => [SELF_NAMED_CONSTRUCTORS]);
4242

43-
impl<'tcx> LateLintPass<'tcx> for SelfNamedConstructor {
43+
impl<'tcx> LateLintPass<'tcx> for SelfNamedConstructors {
4444
fn check_impl_item(&mut self, cx: &LateContext<'tcx>, impl_item: &'tcx ImplItem<'_>) {
4545
match impl_item.kind {
4646
ImplItemKind::Fn(ref sig, _) => {
@@ -81,7 +81,7 @@ impl<'tcx> LateLintPass<'tcx> for SelfNamedConstructor {
8181
then {
8282
span_lint(
8383
cx,
84-
SELF_NAMED_CONSTRUCTOR,
84+
SELF_NAMED_CONSTRUCTORS,
8585
impl_item.span,
8686
&format!("constructor `{}` has the same name as the type", impl_item.ident.name),
8787
);

src/tools/clippy/tests/ui/append_instead_of_extend.fixed renamed to src/tools/clippy/tests/ui/extend_with_drain.fixed

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// run-rustfix
2-
#![warn(clippy::append_instead_of_extend)]
2+
#![warn(clippy::extend_with_drain)]
33
use std::collections::BinaryHeap;
44
fn main() {
55
//gets linted

src/tools/clippy/tests/ui/append_instead_of_extend.rs renamed to src/tools/clippy/tests/ui/extend_with_drain.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// run-rustfix
2-
#![warn(clippy::append_instead_of_extend)]
2+
#![warn(clippy::extend_with_drain)]
33
use std::collections::BinaryHeap;
44
fn main() {
55
//gets linted

src/tools/clippy/tests/ui/append_instead_of_extend.stderr renamed to src/tools/clippy/tests/ui/extend_with_drain.stderr

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
error: use of `extend` instead of `append` for adding the full range of a second vector
2-
--> $DIR/append_instead_of_extend.rs:9:5
2+
--> $DIR/extend_with_drain.rs:9:5
33
|
44
LL | vec2.extend(vec1.drain(..));
55
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `vec2.append(&mut vec1)`
66
|
7-
= note: `-D clippy::append-instead-of-extend` implied by `-D warnings`
7+
= note: `-D clippy::extend-with-drain` implied by `-D warnings`
88

99
error: use of `extend` instead of `append` for adding the full range of a second vector
10-
--> $DIR/append_instead_of_extend.rs:14:5
10+
--> $DIR/extend_with_drain.rs:14:5
1111
|
1212
LL | vec4.extend(vec3.drain(..));
1313
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `vec4.append(&mut vec3)`
1414

1515
error: use of `extend` instead of `append` for adding the full range of a second vector
16-
--> $DIR/append_instead_of_extend.rs:18:5
16+
--> $DIR/extend_with_drain.rs:18:5
1717
|
1818
LL | vec11.extend(return_vector().drain(..));
1919
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `vec11.append(&mut return_vector())`

src/tools/clippy/tests/ui/needless_bool/fixable.fixed

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
clippy::no_effect,
88
clippy::if_same_then_else,
99
clippy::needless_return,
10-
clippy::self_named_constructor
10+
clippy::self_named_constructors
1111
)]
1212

1313
use std::cell::Cell;

src/tools/clippy/tests/ui/needless_bool/fixable.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
clippy::no_effect,
88
clippy::if_same_then_else,
99
clippy::needless_return,
10-
clippy::self_named_constructor
10+
clippy::self_named_constructors
1111
)]
1212

1313
use std::cell::Cell;

src/tools/clippy/tests/ui/self_named_constructor.rs renamed to src/tools/clippy/tests/ui/self_named_constructors.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#![warn(clippy::self_named_constructor)]
1+
#![warn(clippy::self_named_constructors)]
22

33
struct ShouldSpawn;
44
struct ShouldNotSpawn;
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
error: constructor `should_spawn` has the same name as the type
2-
--> $DIR/self_named_constructor.rs:7:5
2+
--> $DIR/self_named_constructors.rs:7:5
33
|
44
LL | / pub fn should_spawn() -> ShouldSpawn {
55
LL | | ShouldSpawn
66
LL | | }
77
| |_____^
88
|
9-
= note: `-D clippy::self-named-constructor` implied by `-D warnings`
9+
= note: `-D clippy::self-named-constructors` implied by `-D warnings`
1010

1111
error: aborting due to previous error
1212

src/tools/clippy/tests/ui/unit_arg.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
clippy::unnecessary_wraps,
88
clippy::or_fun_call,
99
clippy::needless_question_mark,
10-
clippy::self_named_constructor
10+
clippy::self_named_constructors
1111
)]
1212

1313
use std::fmt::Debug;

src/tools/clippy/tests/ui/use_self.fixed

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
clippy::should_implement_trait,
99
clippy::upper_case_acronyms,
1010
clippy::from_over_into,
11-
clippy::self_named_constructor
11+
clippy::self_named_constructors
1212
)]
1313

1414
#[macro_use]

src/tools/clippy/tests/ui/use_self.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
clippy::should_implement_trait,
99
clippy::upper_case_acronyms,
1010
clippy::from_over_into,
11-
clippy::self_named_constructor
11+
clippy::self_named_constructors
1212
)]
1313

1414
#[macro_use]

0 commit comments

Comments
 (0)