Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit e9ced12

Browse files
committed
Rename the lint
1 parent 9a8347d commit e9ced12

10 files changed

+34
-30
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5131,6 +5131,7 @@ Released 2018-09-13
51315131
[`recursive_format_impl`]: https://rust-lang.github.io/rust-clippy/master/index.html#recursive_format_impl
51325132
[`redundant_allocation`]: https://rust-lang.github.io/rust-clippy/master/index.html#redundant_allocation
51335133
[`redundant_async_block`]: https://rust-lang.github.io/rust-clippy/master/index.html#redundant_async_block
5134+
[`redundant_at_rest_pattern`]: https://rust-lang.github.io/rust-clippy/master/index.html#redundant_at_rest_pattern
51345135
[`redundant_clone`]: https://rust-lang.github.io/rust-clippy/master/index.html#redundant_clone
51355136
[`redundant_closure`]: https://rust-lang.github.io/rust-clippy/master/index.html#redundant_closure
51365137
[`redundant_closure_call`]: https://rust-lang.github.io/rust-clippy/master/index.html#redundant_closure_call
@@ -5141,7 +5142,6 @@ Released 2018-09-13
51415142
[`redundant_pattern`]: https://rust-lang.github.io/rust-clippy/master/index.html#redundant_pattern
51425143
[`redundant_pattern_matching`]: https://rust-lang.github.io/rust-clippy/master/index.html#redundant_pattern_matching
51435144
[`redundant_pub_crate`]: https://rust-lang.github.io/rust-clippy/master/index.html#redundant_pub_crate
5144-
[`redundant_rest_pattern`]: https://rust-lang.github.io/rust-clippy/master/index.html#redundant_rest_pattern
51455145
[`redundant_slicing`]: https://rust-lang.github.io/rust-clippy/master/index.html#redundant_slicing
51465146
[`redundant_static_lifetimes`]: https://rust-lang.github.io/rust-clippy/master/index.html#redundant_static_lifetimes
51475147
[`redundant_type_annotations`]: https://rust-lang.github.io/rust-clippy/master/index.html#redundant_type_annotations

clippy_lints/src/declared_lints.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -430,8 +430,8 @@ pub(crate) static LINTS: &[&crate::LintInfo] = &[
430430
crate::misc_early::DOUBLE_NEG_INFO,
431431
crate::misc_early::DUPLICATE_UNDERSCORE_ARGUMENT_INFO,
432432
crate::misc_early::MIXED_CASE_HEX_LITERALS_INFO,
433+
crate::misc_early::REDUNDANT_AT_REST_PATTERN_INFO,
433434
crate::misc_early::REDUNDANT_PATTERN_INFO,
434-
crate::misc_early::REDUNDANT_REST_PATTERN_INFO,
435435
crate::misc_early::SEPARATED_LITERAL_SUFFIX_INFO,
436436
crate::misc_early::UNNEEDED_FIELD_PATTERN_INFO,
437437
crate::misc_early::UNNEEDED_WILDCARD_PATTERN_INFO,

clippy_lints/src/misc_early/mod.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ mod builtin_type_shadow;
22
mod double_neg;
33
mod literal_suffix;
44
mod mixed_case_hex_literals;
5+
mod redundant_at_rest_pattern;
56
mod redundant_pattern;
6-
mod redundant_rest_pattern;
77
mod unneeded_field_pattern;
88
mod unneeded_wildcard_pattern;
99
mod zero_prefixed_literal;
@@ -342,7 +342,7 @@ declare_clippy_lint! {
342342
/// }
343343
/// ```
344344
#[clippy::version = "1.72.0"]
345-
pub REDUNDANT_REST_PATTERN,
345+
pub REDUNDANT_AT_REST_PATTERN,
346346
complexity,
347347
"checks for `[all @ ..]` where `all` would suffice"
348348
}
@@ -358,7 +358,7 @@ declare_lint_pass!(MiscEarlyLints => [
358358
BUILTIN_TYPE_SHADOW,
359359
REDUNDANT_PATTERN,
360360
UNNEEDED_WILDCARD_PATTERN,
361-
REDUNDANT_REST_PATTERN,
361+
REDUNDANT_AT_REST_PATTERN,
362362
]);
363363

364364
impl EarlyLintPass for MiscEarlyLints {
@@ -375,7 +375,7 @@ impl EarlyLintPass for MiscEarlyLints {
375375

376376
unneeded_field_pattern::check(cx, pat);
377377
redundant_pattern::check(cx, pat);
378-
redundant_rest_pattern::check(cx, pat);
378+
redundant_at_rest_pattern::check(cx, pat);
379379
unneeded_wildcard_pattern::check(cx, pat);
380380
}
381381

clippy_lints/src/misc_early/redundant_rest_pattern.rs renamed to clippy_lints/src/misc_early/redundant_at_rest_pattern.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use rustc_errors::Applicability;
44
use rustc_lint::{EarlyContext, LintContext};
55
use rustc_middle::lint::in_external_macro;
66

7-
use super::REDUNDANT_REST_PATTERN;
7+
use super::REDUNDANT_AT_REST_PATTERN;
88

99
pub(super) fn check(cx: &EarlyContext<'_>, pat: &Pat) {
1010
if !in_external_macro(cx.sess(), pat.span)
@@ -15,7 +15,7 @@ pub(super) fn check(cx: &EarlyContext<'_>, pat: &Pat) {
1515
{
1616
span_lint_and_sugg(
1717
cx,
18-
REDUNDANT_REST_PATTERN,
18+
REDUNDANT_AT_REST_PATTERN,
1919
pat.span,
2020
"using a rest pattern to bind an entire slice to a local",
2121
"this is better represented with just the binding",

tests/ui/manual_let_else_match.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
#![allow(unused_braces, unused_variables, dead_code)]
2-
#![allow(clippy::collapsible_else_if, clippy::let_unit_value, clippy::redundant_rest_pattern)]
2+
#![allow(
3+
clippy::collapsible_else_if,
4+
clippy::let_unit_value,
5+
clippy::redundant_at_rest_pattern
6+
)]
37
#![warn(clippy::manual_let_else)]
48
// Ensure that we don't conflict with match -> if let lints
59
#![warn(clippy::single_match_else, clippy::single_match)]

tests/ui/manual_let_else_match.stderr

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error: this could be rewritten as `let...else`
2-
--> $DIR/manual_let_else_match.rs:32:5
2+
--> $DIR/manual_let_else_match.rs:36:5
33
|
44
LL | / let v = match g() {
55
LL | | Some(v_some) => v_some,
@@ -10,7 +10,7 @@ LL | | };
1010
= note: `-D clippy::manual-let-else` implied by `-D warnings`
1111

1212
error: this could be rewritten as `let...else`
13-
--> $DIR/manual_let_else_match.rs:37:5
13+
--> $DIR/manual_let_else_match.rs:41:5
1414
|
1515
LL | / let v = match g() {
1616
LL | | Some(v_some) => v_some,
@@ -19,7 +19,7 @@ LL | | };
1919
| |______^ help: consider writing: `let Some(v) = g() else { return };`
2020

2121
error: this could be rewritten as `let...else`
22-
--> $DIR/manual_let_else_match.rs:44:9
22+
--> $DIR/manual_let_else_match.rs:48:9
2323
|
2424
LL | / let v = match h() {
2525
LL | | (Some(v), None) | (None, Some(v)) => v,
@@ -28,7 +28,7 @@ LL | | };
2828
| |__________^ help: consider writing: `let ((Some(v), None) | (None, Some(v))) = h() else { continue };`
2929

3030
error: this could be rewritten as `let...else`
31-
--> $DIR/manual_let_else_match.rs:49:9
31+
--> $DIR/manual_let_else_match.rs:53:9
3232
|
3333
LL | / let v = match build_enum() {
3434
LL | | Variant::Bar(v) | Variant::Baz(v) => v,
@@ -37,7 +37,7 @@ LL | | };
3737
| |__________^ help: consider writing: `let (Variant::Bar(v) | Variant::Baz(v)) = build_enum() else { continue };`
3838

3939
error: this could be rewritten as `let...else`
40-
--> $DIR/manual_let_else_match.rs:57:5
40+
--> $DIR/manual_let_else_match.rs:61:5
4141
|
4242
LL | / let v = match f() {
4343
LL | | Ok(v) => v,
@@ -46,7 +46,7 @@ LL | | };
4646
| |______^ help: consider writing: `let Ok(v) = f() else { return };`
4747

4848
error: this could be rewritten as `let...else`
49-
--> $DIR/manual_let_else_match.rs:63:5
49+
--> $DIR/manual_let_else_match.rs:67:5
5050
|
5151
LL | / let v = match f().map_err(|_| ()) {
5252
LL | | Ok(v) => v,
@@ -55,7 +55,7 @@ LL | | };
5555
| |______^ help: consider writing: `let Ok(v) = f().map_err(|_| ()) else { return };`
5656

5757
error: this could be rewritten as `let...else`
58-
--> $DIR/manual_let_else_match.rs:70:5
58+
--> $DIR/manual_let_else_match.rs:74:5
5959
|
6060
LL | / let _value = match f {
6161
LL | | Variant::Bar(v) | Variant::Baz(v) => v,
@@ -64,7 +64,7 @@ LL | | };
6464
| |______^ help: consider writing: `let (Variant::Bar(_value) | Variant::Baz(_value)) = f else { return };`
6565

6666
error: this could be rewritten as `let...else`
67-
--> $DIR/manual_let_else_match.rs:75:5
67+
--> $DIR/manual_let_else_match.rs:79:5
6868
|
6969
LL | / let _value = match Some(build_enum()) {
7070
LL | | Some(Variant::Bar(v) | Variant::Baz(v)) => v,
@@ -73,7 +73,7 @@ LL | | };
7373
| |______^ help: consider writing: `let Some(Variant::Bar(_value) | Variant::Baz(_value)) = Some(build_enum()) else { return };`
7474

7575
error: this could be rewritten as `let...else`
76-
--> $DIR/manual_let_else_match.rs:81:5
76+
--> $DIR/manual_let_else_match.rs:85:5
7777
|
7878
LL | / let data = match data.as_slice() {
7979
LL | | [data @ .., 0, 0, 0, 0] | [data @ .., 0, 0] | [data @ .., 0] => data,

tests/ui/match_on_vec_items.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#![warn(clippy::match_on_vec_items)]
2-
#![allow(clippy::redundant_rest_pattern, clippy::useless_vec)]
2+
#![allow(clippy::redundant_at_rest_pattern, clippy::useless_vec)]
33

44
fn match_with_wildcard() {
55
let arr = vec![0, 1, 2, 3];

tests/ui/redundant_rest_pattern.fixed renamed to tests/ui/redundant_at_rest_pattern.fixed

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//@run-rustfix
2-
//@aux-build:proc_macros.rs
2+
//@aux-build:proc_macros.rs:proc-macro
33
#![allow(irrefutable_let_patterns, unused)]
4-
#![warn(clippy::redundant_rest_pattern)]
4+
#![warn(clippy::redundant_at_rest_pattern)]
55

66
#[macro_use]
77
extern crate proc_macros;

tests/ui/redundant_rest_pattern.rs renamed to tests/ui/redundant_at_rest_pattern.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//@run-rustfix
2-
//@aux-build:proc_macros.rs
2+
//@aux-build:proc_macros.rs:proc-macro
33
#![allow(irrefutable_let_patterns, unused)]
4-
#![warn(clippy::redundant_rest_pattern)]
4+
#![warn(clippy::redundant_at_rest_pattern)]
55

66
#[macro_use]
77
extern crate proc_macros;

tests/ui/redundant_rest_pattern.stderr renamed to tests/ui/redundant_at_rest_pattern.stderr

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,37 @@
11
error: using a rest pattern to bind an entire slice to a local
2-
--> $DIR/redundant_rest_pattern.rs:10:12
2+
--> $DIR/redundant_at_rest_pattern.rs:10:12
33
|
44
LL | if let [a @ ..] = [()] {}
55
| ^^^^^^^^ help: this is better represented with just the binding: `a`
66
|
7-
= note: `-D clippy::redundant-rest-pattern` implied by `-D warnings`
7+
= note: `-D clippy::redundant-at-rest-pattern` implied by `-D warnings`
88

99
error: using a rest pattern to bind an entire slice to a local
10-
--> $DIR/redundant_rest_pattern.rs:11:12
10+
--> $DIR/redundant_at_rest_pattern.rs:11:12
1111
|
1212
LL | if let [ref a @ ..] = [()] {}
1313
| ^^^^^^^^^^^^ help: this is better represented with just the binding: `ref a`
1414

1515
error: using a rest pattern to bind an entire slice to a local
16-
--> $DIR/redundant_rest_pattern.rs:12:12
16+
--> $DIR/redundant_at_rest_pattern.rs:12:12
1717
|
1818
LL | if let [mut a @ ..] = [()] {}
1919
| ^^^^^^^^^^^^ help: this is better represented with just the binding: `mut a`
2020

2121
error: using a rest pattern to bind an entire slice to a local
22-
--> $DIR/redundant_rest_pattern.rs:13:12
22+
--> $DIR/redundant_at_rest_pattern.rs:13:12
2323
|
2424
LL | if let [ref mut a @ ..] = [()] {}
2525
| ^^^^^^^^^^^^^^^^ help: this is better represented with just the binding: `ref mut a`
2626

2727
error: using a rest pattern to bind an entire slice to a local
28-
--> $DIR/redundant_rest_pattern.rs:15:12
28+
--> $DIR/redundant_at_rest_pattern.rs:15:12
2929
|
3030
LL | if let [a @ ..] = &*v {}
3131
| ^^^^^^^^ help: this is better represented with just the binding: `a`
3232

3333
error: using a rest pattern to bind an entire slice to a local
34-
--> $DIR/redundant_rest_pattern.rs:17:12
34+
--> $DIR/redundant_at_rest_pattern.rs:17:12
3535
|
3636
LL | if let [a @ ..] = s {}
3737
| ^^^^^^^^ help: this is better represented with just the binding: `a`

0 commit comments

Comments
 (0)