Rename the lint

This commit is contained in:
Catherine 2023-06-27 06:09:28 -05:00
parent 9a8347ded5
commit e9ced12512
10 changed files with 34 additions and 30 deletions

View File

@ -5131,6 +5131,7 @@ Released 2018-09-13
[`recursive_format_impl`]: https://rust-lang.github.io/rust-clippy/master/index.html#recursive_format_impl [`recursive_format_impl`]: https://rust-lang.github.io/rust-clippy/master/index.html#recursive_format_impl
[`redundant_allocation`]: https://rust-lang.github.io/rust-clippy/master/index.html#redundant_allocation [`redundant_allocation`]: https://rust-lang.github.io/rust-clippy/master/index.html#redundant_allocation
[`redundant_async_block`]: https://rust-lang.github.io/rust-clippy/master/index.html#redundant_async_block [`redundant_async_block`]: https://rust-lang.github.io/rust-clippy/master/index.html#redundant_async_block
[`redundant_at_rest_pattern`]: https://rust-lang.github.io/rust-clippy/master/index.html#redundant_at_rest_pattern
[`redundant_clone`]: https://rust-lang.github.io/rust-clippy/master/index.html#redundant_clone [`redundant_clone`]: https://rust-lang.github.io/rust-clippy/master/index.html#redundant_clone
[`redundant_closure`]: https://rust-lang.github.io/rust-clippy/master/index.html#redundant_closure [`redundant_closure`]: https://rust-lang.github.io/rust-clippy/master/index.html#redundant_closure
[`redundant_closure_call`]: https://rust-lang.github.io/rust-clippy/master/index.html#redundant_closure_call [`redundant_closure_call`]: https://rust-lang.github.io/rust-clippy/master/index.html#redundant_closure_call
@ -5141,7 +5142,6 @@ Released 2018-09-13
[`redundant_pattern`]: https://rust-lang.github.io/rust-clippy/master/index.html#redundant_pattern [`redundant_pattern`]: https://rust-lang.github.io/rust-clippy/master/index.html#redundant_pattern
[`redundant_pattern_matching`]: https://rust-lang.github.io/rust-clippy/master/index.html#redundant_pattern_matching [`redundant_pattern_matching`]: https://rust-lang.github.io/rust-clippy/master/index.html#redundant_pattern_matching
[`redundant_pub_crate`]: https://rust-lang.github.io/rust-clippy/master/index.html#redundant_pub_crate [`redundant_pub_crate`]: https://rust-lang.github.io/rust-clippy/master/index.html#redundant_pub_crate
[`redundant_rest_pattern`]: https://rust-lang.github.io/rust-clippy/master/index.html#redundant_rest_pattern
[`redundant_slicing`]: https://rust-lang.github.io/rust-clippy/master/index.html#redundant_slicing [`redundant_slicing`]: https://rust-lang.github.io/rust-clippy/master/index.html#redundant_slicing
[`redundant_static_lifetimes`]: https://rust-lang.github.io/rust-clippy/master/index.html#redundant_static_lifetimes [`redundant_static_lifetimes`]: https://rust-lang.github.io/rust-clippy/master/index.html#redundant_static_lifetimes
[`redundant_type_annotations`]: https://rust-lang.github.io/rust-clippy/master/index.html#redundant_type_annotations [`redundant_type_annotations`]: https://rust-lang.github.io/rust-clippy/master/index.html#redundant_type_annotations

View File

@ -430,8 +430,8 @@
crate::misc_early::DOUBLE_NEG_INFO, crate::misc_early::DOUBLE_NEG_INFO,
crate::misc_early::DUPLICATE_UNDERSCORE_ARGUMENT_INFO, crate::misc_early::DUPLICATE_UNDERSCORE_ARGUMENT_INFO,
crate::misc_early::MIXED_CASE_HEX_LITERALS_INFO, crate::misc_early::MIXED_CASE_HEX_LITERALS_INFO,
crate::misc_early::REDUNDANT_AT_REST_PATTERN_INFO,
crate::misc_early::REDUNDANT_PATTERN_INFO, crate::misc_early::REDUNDANT_PATTERN_INFO,
crate::misc_early::REDUNDANT_REST_PATTERN_INFO,
crate::misc_early::SEPARATED_LITERAL_SUFFIX_INFO, crate::misc_early::SEPARATED_LITERAL_SUFFIX_INFO,
crate::misc_early::UNNEEDED_FIELD_PATTERN_INFO, crate::misc_early::UNNEEDED_FIELD_PATTERN_INFO,
crate::misc_early::UNNEEDED_WILDCARD_PATTERN_INFO, crate::misc_early::UNNEEDED_WILDCARD_PATTERN_INFO,

View File

@ -2,8 +2,8 @@
mod double_neg; mod double_neg;
mod literal_suffix; mod literal_suffix;
mod mixed_case_hex_literals; mod mixed_case_hex_literals;
mod redundant_at_rest_pattern;
mod redundant_pattern; mod redundant_pattern;
mod redundant_rest_pattern;
mod unneeded_field_pattern; mod unneeded_field_pattern;
mod unneeded_wildcard_pattern; mod unneeded_wildcard_pattern;
mod zero_prefixed_literal; mod zero_prefixed_literal;
@ -342,7 +342,7 @@
/// } /// }
/// ``` /// ```
#[clippy::version = "1.72.0"] #[clippy::version = "1.72.0"]
pub REDUNDANT_REST_PATTERN, pub REDUNDANT_AT_REST_PATTERN,
complexity, complexity,
"checks for `[all @ ..]` where `all` would suffice" "checks for `[all @ ..]` where `all` would suffice"
} }
@ -358,7 +358,7 @@
BUILTIN_TYPE_SHADOW, BUILTIN_TYPE_SHADOW,
REDUNDANT_PATTERN, REDUNDANT_PATTERN,
UNNEEDED_WILDCARD_PATTERN, UNNEEDED_WILDCARD_PATTERN,
REDUNDANT_REST_PATTERN, REDUNDANT_AT_REST_PATTERN,
]); ]);
impl EarlyLintPass for MiscEarlyLints { impl EarlyLintPass for MiscEarlyLints {
@ -375,7 +375,7 @@ fn check_pat(&mut self, cx: &EarlyContext<'_>, pat: &Pat) {
unneeded_field_pattern::check(cx, pat); unneeded_field_pattern::check(cx, pat);
redundant_pattern::check(cx, pat); redundant_pattern::check(cx, pat);
redundant_rest_pattern::check(cx, pat); redundant_at_rest_pattern::check(cx, pat);
unneeded_wildcard_pattern::check(cx, pat); unneeded_wildcard_pattern::check(cx, pat);
} }

View File

@ -4,7 +4,7 @@
use rustc_lint::{EarlyContext, LintContext}; use rustc_lint::{EarlyContext, LintContext};
use rustc_middle::lint::in_external_macro; use rustc_middle::lint::in_external_macro;
use super::REDUNDANT_REST_PATTERN; use super::REDUNDANT_AT_REST_PATTERN;
pub(super) fn check(cx: &EarlyContext<'_>, pat: &Pat) { pub(super) fn check(cx: &EarlyContext<'_>, pat: &Pat) {
if !in_external_macro(cx.sess(), pat.span) if !in_external_macro(cx.sess(), pat.span)
@ -15,7 +15,7 @@ pub(super) fn check(cx: &EarlyContext<'_>, pat: &Pat) {
{ {
span_lint_and_sugg( span_lint_and_sugg(
cx, cx,
REDUNDANT_REST_PATTERN, REDUNDANT_AT_REST_PATTERN,
pat.span, pat.span,
"using a rest pattern to bind an entire slice to a local", "using a rest pattern to bind an entire slice to a local",
"this is better represented with just the binding", "this is better represented with just the binding",

View File

@ -1,5 +1,9 @@
#![allow(unused_braces, unused_variables, dead_code)] #![allow(unused_braces, unused_variables, dead_code)]
#![allow(clippy::collapsible_else_if, clippy::let_unit_value, clippy::redundant_rest_pattern)] #![allow(
clippy::collapsible_else_if,
clippy::let_unit_value,
clippy::redundant_at_rest_pattern
)]
#![warn(clippy::manual_let_else)] #![warn(clippy::manual_let_else)]
// Ensure that we don't conflict with match -> if let lints // Ensure that we don't conflict with match -> if let lints
#![warn(clippy::single_match_else, clippy::single_match)] #![warn(clippy::single_match_else, clippy::single_match)]

View File

@ -1,5 +1,5 @@
error: this could be rewritten as `let...else` error: this could be rewritten as `let...else`
--> $DIR/manual_let_else_match.rs:32:5 --> $DIR/manual_let_else_match.rs:36:5
| |
LL | / let v = match g() { LL | / let v = match g() {
LL | | Some(v_some) => v_some, LL | | Some(v_some) => v_some,
@ -10,7 +10,7 @@ LL | | };
= note: `-D clippy::manual-let-else` implied by `-D warnings` = note: `-D clippy::manual-let-else` implied by `-D warnings`
error: this could be rewritten as `let...else` error: this could be rewritten as `let...else`
--> $DIR/manual_let_else_match.rs:37:5 --> $DIR/manual_let_else_match.rs:41:5
| |
LL | / let v = match g() { LL | / let v = match g() {
LL | | Some(v_some) => v_some, LL | | Some(v_some) => v_some,
@ -19,7 +19,7 @@ LL | | };
| |______^ help: consider writing: `let Some(v) = g() else { return };` | |______^ help: consider writing: `let Some(v) = g() else { return };`
error: this could be rewritten as `let...else` error: this could be rewritten as `let...else`
--> $DIR/manual_let_else_match.rs:44:9 --> $DIR/manual_let_else_match.rs:48:9
| |
LL | / let v = match h() { LL | / let v = match h() {
LL | | (Some(v), None) | (None, Some(v)) => v, LL | | (Some(v), None) | (None, Some(v)) => v,
@ -28,7 +28,7 @@ LL | | };
| |__________^ help: consider writing: `let ((Some(v), None) | (None, Some(v))) = h() else { continue };` | |__________^ help: consider writing: `let ((Some(v), None) | (None, Some(v))) = h() else { continue };`
error: this could be rewritten as `let...else` error: this could be rewritten as `let...else`
--> $DIR/manual_let_else_match.rs:49:9 --> $DIR/manual_let_else_match.rs:53:9
| |
LL | / let v = match build_enum() { LL | / let v = match build_enum() {
LL | | Variant::Bar(v) | Variant::Baz(v) => v, LL | | Variant::Bar(v) | Variant::Baz(v) => v,
@ -37,7 +37,7 @@ LL | | };
| |__________^ help: consider writing: `let (Variant::Bar(v) | Variant::Baz(v)) = build_enum() else { continue };` | |__________^ help: consider writing: `let (Variant::Bar(v) | Variant::Baz(v)) = build_enum() else { continue };`
error: this could be rewritten as `let...else` error: this could be rewritten as `let...else`
--> $DIR/manual_let_else_match.rs:57:5 --> $DIR/manual_let_else_match.rs:61:5
| |
LL | / let v = match f() { LL | / let v = match f() {
LL | | Ok(v) => v, LL | | Ok(v) => v,
@ -46,7 +46,7 @@ LL | | };
| |______^ help: consider writing: `let Ok(v) = f() else { return };` | |______^ help: consider writing: `let Ok(v) = f() else { return };`
error: this could be rewritten as `let...else` error: this could be rewritten as `let...else`
--> $DIR/manual_let_else_match.rs:63:5 --> $DIR/manual_let_else_match.rs:67:5
| |
LL | / let v = match f().map_err(|_| ()) { LL | / let v = match f().map_err(|_| ()) {
LL | | Ok(v) => v, LL | | Ok(v) => v,
@ -55,7 +55,7 @@ LL | | };
| |______^ help: consider writing: `let Ok(v) = f().map_err(|_| ()) else { return };` | |______^ help: consider writing: `let Ok(v) = f().map_err(|_| ()) else { return };`
error: this could be rewritten as `let...else` error: this could be rewritten as `let...else`
--> $DIR/manual_let_else_match.rs:70:5 --> $DIR/manual_let_else_match.rs:74:5
| |
LL | / let _value = match f { LL | / let _value = match f {
LL | | Variant::Bar(v) | Variant::Baz(v) => v, LL | | Variant::Bar(v) | Variant::Baz(v) => v,
@ -64,7 +64,7 @@ LL | | };
| |______^ help: consider writing: `let (Variant::Bar(_value) | Variant::Baz(_value)) = f else { return };` | |______^ help: consider writing: `let (Variant::Bar(_value) | Variant::Baz(_value)) = f else { return };`
error: this could be rewritten as `let...else` error: this could be rewritten as `let...else`
--> $DIR/manual_let_else_match.rs:75:5 --> $DIR/manual_let_else_match.rs:79:5
| |
LL | / let _value = match Some(build_enum()) { LL | / let _value = match Some(build_enum()) {
LL | | Some(Variant::Bar(v) | Variant::Baz(v)) => v, LL | | Some(Variant::Bar(v) | Variant::Baz(v)) => v,
@ -73,7 +73,7 @@ LL | | };
| |______^ help: consider writing: `let Some(Variant::Bar(_value) | Variant::Baz(_value)) = Some(build_enum()) else { return };` | |______^ help: consider writing: `let Some(Variant::Bar(_value) | Variant::Baz(_value)) = Some(build_enum()) else { return };`
error: this could be rewritten as `let...else` error: this could be rewritten as `let...else`
--> $DIR/manual_let_else_match.rs:81:5 --> $DIR/manual_let_else_match.rs:85:5
| |
LL | / let data = match data.as_slice() { LL | / let data = match data.as_slice() {
LL | | [data @ .., 0, 0, 0, 0] | [data @ .., 0, 0] | [data @ .., 0] => data, LL | | [data @ .., 0, 0, 0, 0] | [data @ .., 0, 0] | [data @ .., 0] => data,

View File

@ -1,5 +1,5 @@
#![warn(clippy::match_on_vec_items)] #![warn(clippy::match_on_vec_items)]
#![allow(clippy::redundant_rest_pattern, clippy::useless_vec)] #![allow(clippy::redundant_at_rest_pattern, clippy::useless_vec)]
fn match_with_wildcard() { fn match_with_wildcard() {
let arr = vec![0, 1, 2, 3]; let arr = vec![0, 1, 2, 3];

View File

@ -1,7 +1,7 @@
//@run-rustfix //@run-rustfix
//@aux-build:proc_macros.rs //@aux-build:proc_macros.rs:proc-macro
#![allow(irrefutable_let_patterns, unused)] #![allow(irrefutable_let_patterns, unused)]
#![warn(clippy::redundant_rest_pattern)] #![warn(clippy::redundant_at_rest_pattern)]
#[macro_use] #[macro_use]
extern crate proc_macros; extern crate proc_macros;

View File

@ -1,7 +1,7 @@
//@run-rustfix //@run-rustfix
//@aux-build:proc_macros.rs //@aux-build:proc_macros.rs:proc-macro
#![allow(irrefutable_let_patterns, unused)] #![allow(irrefutable_let_patterns, unused)]
#![warn(clippy::redundant_rest_pattern)] #![warn(clippy::redundant_at_rest_pattern)]
#[macro_use] #[macro_use]
extern crate proc_macros; extern crate proc_macros;

View File

@ -1,37 +1,37 @@
error: using a rest pattern to bind an entire slice to a local error: using a rest pattern to bind an entire slice to a local
--> $DIR/redundant_rest_pattern.rs:10:12 --> $DIR/redundant_at_rest_pattern.rs:10:12
| |
LL | if let [a @ ..] = [()] {} LL | if let [a @ ..] = [()] {}
| ^^^^^^^^ help: this is better represented with just the binding: `a` | ^^^^^^^^ help: this is better represented with just the binding: `a`
| |
= note: `-D clippy::redundant-rest-pattern` implied by `-D warnings` = note: `-D clippy::redundant-at-rest-pattern` implied by `-D warnings`
error: using a rest pattern to bind an entire slice to a local error: using a rest pattern to bind an entire slice to a local
--> $DIR/redundant_rest_pattern.rs:11:12 --> $DIR/redundant_at_rest_pattern.rs:11:12
| |
LL | if let [ref a @ ..] = [()] {} LL | if let [ref a @ ..] = [()] {}
| ^^^^^^^^^^^^ help: this is better represented with just the binding: `ref a` | ^^^^^^^^^^^^ help: this is better represented with just the binding: `ref a`
error: using a rest pattern to bind an entire slice to a local error: using a rest pattern to bind an entire slice to a local
--> $DIR/redundant_rest_pattern.rs:12:12 --> $DIR/redundant_at_rest_pattern.rs:12:12
| |
LL | if let [mut a @ ..] = [()] {} LL | if let [mut a @ ..] = [()] {}
| ^^^^^^^^^^^^ help: this is better represented with just the binding: `mut a` | ^^^^^^^^^^^^ help: this is better represented with just the binding: `mut a`
error: using a rest pattern to bind an entire slice to a local error: using a rest pattern to bind an entire slice to a local
--> $DIR/redundant_rest_pattern.rs:13:12 --> $DIR/redundant_at_rest_pattern.rs:13:12
| |
LL | if let [ref mut a @ ..] = [()] {} LL | if let [ref mut a @ ..] = [()] {}
| ^^^^^^^^^^^^^^^^ help: this is better represented with just the binding: `ref mut a` | ^^^^^^^^^^^^^^^^ help: this is better represented with just the binding: `ref mut a`
error: using a rest pattern to bind an entire slice to a local error: using a rest pattern to bind an entire slice to a local
--> $DIR/redundant_rest_pattern.rs:15:12 --> $DIR/redundant_at_rest_pattern.rs:15:12
| |
LL | if let [a @ ..] = &*v {} LL | if let [a @ ..] = &*v {}
| ^^^^^^^^ help: this is better represented with just the binding: `a` | ^^^^^^^^ help: this is better represented with just the binding: `a`
error: using a rest pattern to bind an entire slice to a local error: using a rest pattern to bind an entire slice to a local
--> $DIR/redundant_rest_pattern.rs:17:12 --> $DIR/redundant_at_rest_pattern.rs:17:12
| |
LL | if let [a @ ..] = s {} LL | if let [a @ ..] = s {}
| ^^^^^^^^ help: this is better represented with just the binding: `a` | ^^^^^^^^ help: this is better represented with just the binding: `a`