Skip to content

Commit 6254f35

Browse files
CrazyRokaThibsG
authored andcommitted
Renamed lint to match_on_vec_items
1 parent 90c5c1c commit 6254f35

File tree

6 files changed

+28
-28
lines changed

6 files changed

+28
-28
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1431,11 +1431,11 @@ Released 2018-09-13
14311431
[`map_flatten`]: https://rust-lang.github.io/rust-clippy/master/index.html#map_flatten
14321432
[`match_as_ref`]: https://rust-lang.github.io/rust-clippy/master/index.html#match_as_ref
14331433
[`match_bool`]: https://rust-lang.github.io/rust-clippy/master/index.html#match_bool
1434+
[`match_on_vec_items`]: https://rust-lang.github.io/rust-clippy/master/index.html#match_on_vec_items
14341435
[`match_overlapping_arm`]: https://rust-lang.github.io/rust-clippy/master/index.html#match_overlapping_arm
14351436
[`match_ref_pats`]: https://rust-lang.github.io/rust-clippy/master/index.html#match_ref_pats
14361437
[`match_same_arms`]: https://rust-lang.github.io/rust-clippy/master/index.html#match_same_arms
14371438
[`match_single_binding`]: https://rust-lang.github.io/rust-clippy/master/index.html#match_single_binding
1438-
[`match_vec_item`]: https://rust-lang.github.io/rust-clippy/master/index.html#match_vec_item
14391439
[`match_wild_err_arm`]: https://rust-lang.github.io/rust-clippy/master/index.html#match_wild_err_arm
14401440
[`maybe_infinite_iter`]: https://rust-lang.github.io/rust-clippy/master/index.html#maybe_infinite_iter
14411441
[`mem_discriminant_non_enum`]: https://rust-lang.github.io/rust-clippy/master/index.html#mem_discriminant_non_enum

clippy_lints/src/lib.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ mod macro_use;
249249
mod main_recursion;
250250
mod map_clone;
251251
mod map_unit_fn;
252-
mod match_vec_item;
252+
mod match_on_vec_items;
253253
mod matches;
254254
mod mem_discriminant;
255255
mod mem_forget;
@@ -631,7 +631,7 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
631631
&map_clone::MAP_CLONE,
632632
&map_unit_fn::OPTION_MAP_UNIT_FN,
633633
&map_unit_fn::RESULT_MAP_UNIT_FN,
634-
&match_vec_item::MATCH_VEC_ITEM,
634+
&match_on_vec_items::MATCH_ON_VEC_ITEMS,
635635
&matches::INFALLIBLE_DESTRUCTURING_MATCH,
636636
&matches::MATCH_AS_REF,
637637
&matches::MATCH_BOOL,
@@ -1063,7 +1063,7 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
10631063
store.register_late_pass(|| box future_not_send::FutureNotSend);
10641064
store.register_late_pass(|| box utils::internal_lints::CollapsibleCalls);
10651065
store.register_late_pass(|| box if_let_mutex::IfLetMutex);
1066-
store.register_late_pass(|| box match_vec_item::MatchVecItem);
1066+
store.register_late_pass(|| box match_on_vec_items::MatchOnVecItems);
10671067

10681068
store.register_group(true, "clippy::restriction", Some("clippy_restriction"), vec![
10691069
LintId::of(&arithmetic::FLOAT_ARITHMETIC),
@@ -1283,7 +1283,7 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
12831283
LintId::of(&map_clone::MAP_CLONE),
12841284
LintId::of(&map_unit_fn::OPTION_MAP_UNIT_FN),
12851285
LintId::of(&map_unit_fn::RESULT_MAP_UNIT_FN),
1286-
LintId::of(&match_vec_item::MATCH_VEC_ITEM),
1286+
LintId::of(&match_on_vec_items::MATCH_ON_VEC_ITEMS),
12871287
LintId::of(&matches::INFALLIBLE_DESTRUCTURING_MATCH),
12881288
LintId::of(&matches::MATCH_AS_REF),
12891289
LintId::of(&matches::MATCH_OVERLAPPING_ARM),
@@ -1475,7 +1475,7 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
14751475
LintId::of(&loops::WHILE_LET_ON_ITERATOR),
14761476
LintId::of(&main_recursion::MAIN_RECURSION),
14771477
LintId::of(&map_clone::MAP_CLONE),
1478-
LintId::of(&match_vec_item::MATCH_VEC_ITEM),
1478+
LintId::of(&match_on_vec_items::MATCH_ON_VEC_ITEMS),
14791479
LintId::of(&matches::INFALLIBLE_DESTRUCTURING_MATCH),
14801480
LintId::of(&matches::MATCH_OVERLAPPING_ARM),
14811481
LintId::of(&matches::MATCH_REF_PATS),

clippy_lints/src/match_vec_item.rs renamed to clippy_lints/src/match_on_vec_items.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,14 +37,14 @@ declare_clippy_lint! {
3737
/// _ => {},
3838
/// }
3939
/// ```
40-
pub MATCH_VEC_ITEM,
40+
pub MATCH_ON_VEC_ITEMS,
4141
style,
42-
"match vector by indexing can panic"
42+
"matching on vector elements can panic"
4343
}
4444

45-
declare_lint_pass!(MatchVecItem => [MATCH_VEC_ITEM]);
45+
declare_lint_pass!(MatchOnVecItems => [MATCH_ON_VEC_ITEMS]);
4646

47-
impl<'a, 'tcx> LateLintPass<'a, 'tcx> for MatchVecItem {
47+
impl<'a, 'tcx> LateLintPass<'a, 'tcx> for MatchOnVecItems {
4848
fn check_expr(&mut self, cx: &LateContext<'a, 'tcx>, expr: &'tcx Expr<'tcx>) {
4949
if_chain! {
5050
if !in_external_macro(cx.sess(), expr.span);
@@ -56,7 +56,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for MatchVecItem {
5656
let mut applicability = Applicability::MaybeIncorrect;
5757
span_lint_and_sugg(
5858
cx,
59-
MATCH_VEC_ITEM,
59+
MATCH_ON_VEC_ITEMS,
6060
match_expr.span,
6161
"indexing vector may panic. Consider using `get`",
6262
"try this",

src/lintlist/mod.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1144,6 +1144,13 @@ pub static ref ALL_LINTS: Vec<Lint> = vec![
11441144
deprecation: None,
11451145
module: "matches",
11461146
},
1147+
Lint {
1148+
name: "match_on_vec_items",
1149+
group: "style",
1150+
desc: "matching on vector elements can panic",
1151+
deprecation: None,
1152+
module: "match_on_vec_items",
1153+
},
11471154
Lint {
11481155
name: "match_overlapping_arm",
11491156
group: "style",
@@ -1172,13 +1179,6 @@ pub static ref ALL_LINTS: Vec<Lint> = vec![
11721179
deprecation: None,
11731180
module: "matches",
11741181
},
1175-
Lint {
1176-
name: "match_vec_item",
1177-
group: "style",
1178-
desc: "match vector by indexing can panic",
1179-
deprecation: None,
1180-
module: "match_vec_item",
1181-
},
11821182
Lint {
11831183
name: "match_wild_err_arm",
11841184
group: "style",

tests/ui/match_vec_item.rs renamed to tests/ui/match_on_vec_items.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#![warn(clippy::match_vec_item)]
1+
#![warn(clippy::match_on_vec_items)]
22

33
fn main() {
44
match_with_wildcard();

tests/ui/match_vec_item.stderr renamed to tests/ui/match_on_vec_items.stderr

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,49 @@
11
error: indexing vector may panic. Consider using `get`
2-
--> $DIR/match_vec_item.rs:18:11
2+
--> $DIR/match_on_vec_items.rs:18:11
33
|
44
LL | match arr[idx] {
55
| ^^^^^^^^ help: try this: `arr.get(idx)`
66
|
7-
= note: `-D clippy::match-vec-item` implied by `-D warnings`
7+
= note: `-D clippy::match-on-vec-items` implied by `-D warnings`
88

99
error: indexing vector may panic. Consider using `get`
10-
--> $DIR/match_vec_item.rs:25:11
10+
--> $DIR/match_on_vec_items.rs:25:11
1111
|
1212
LL | match arr[range] {
1313
| ^^^^^^^^^^ help: try this: `arr.get(range)`
1414

1515
error: indexing vector may panic. Consider using `get`
16-
--> $DIR/match_vec_item.rs:38:11
16+
--> $DIR/match_on_vec_items.rs:38:11
1717
|
1818
LL | match arr[idx] {
1919
| ^^^^^^^^ help: try this: `arr.get(idx)`
2020

2121
error: indexing vector may panic. Consider using `get`
22-
--> $DIR/match_vec_item.rs:45:11
22+
--> $DIR/match_on_vec_items.rs:45:11
2323
|
2424
LL | match arr[range] {
2525
| ^^^^^^^^^^ help: try this: `arr.get(range)`
2626

2727
error: indexing vector may panic. Consider using `get`
28-
--> $DIR/match_vec_item.rs:58:11
28+
--> $DIR/match_on_vec_items.rs:58:11
2929
|
3030
LL | match arr[idx] {
3131
| ^^^^^^^^ help: try this: `arr.get(idx)`
3232

3333
error: indexing vector may panic. Consider using `get`
34-
--> $DIR/match_vec_item.rs:65:11
34+
--> $DIR/match_on_vec_items.rs:65:11
3535
|
3636
LL | match arr[range] {
3737
| ^^^^^^^^^^ help: try this: `arr.get(range)`
3838

3939
error: indexing vector may panic. Consider using `get`
40-
--> $DIR/match_vec_item.rs:78:11
40+
--> $DIR/match_on_vec_items.rs:78:11
4141
|
4242
LL | match arr[idx] {
4343
| ^^^^^^^^ help: try this: `arr.get(idx)`
4444

4545
error: indexing vector may panic. Consider using `get`
46-
--> $DIR/match_vec_item.rs:85:11
46+
--> $DIR/match_on_vec_items.rs:85:11
4747
|
4848
LL | match arr[range] {
4949
| ^^^^^^^^^^ help: try this: `arr.get(range)`

0 commit comments

Comments
 (0)