Skip to content

Commit 63b451e

Browse files
committed
Renamed lint to match_on_vec_items
1 parent b0115fb commit 63b451e

File tree

6 files changed

+28
-28
lines changed

6 files changed

+28
-28
lines changed

CHANGELOG.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1348,11 +1348,11 @@ Released 2018-09-13
13481348
[`map_flatten`]: https://rust-lang.github.io/rust-clippy/master/index.html#map_flatten
13491349
[`match_as_ref`]: https://rust-lang.github.io/rust-clippy/master/index.html#match_as_ref
13501350
[`match_bool`]: https://rust-lang.github.io/rust-clippy/master/index.html#match_bool
1351+
[`match_on_vec_items`]: https://rust-lang.github.io/rust-clippy/master/index.html#match_on_vec_items
13511352
[`match_overlapping_arm`]: https://rust-lang.github.io/rust-clippy/master/index.html#match_overlapping_arm
13521353
[`match_ref_pats`]: https://rust-lang.github.io/rust-clippy/master/index.html#match_ref_pats
13531354
[`match_same_arms`]: https://rust-lang.github.io/rust-clippy/master/index.html#match_same_arms
13541355
[`match_single_binding`]: https://rust-lang.github.io/rust-clippy/master/index.html#match_single_binding
1355-
[`match_vec_item`]: https://rust-lang.github.io/rust-clippy/master/index.html#match_vec_item
13561356
[`match_wild_err_arm`]: https://rust-lang.github.io/rust-clippy/master/index.html#match_wild_err_arm
13571357
[`maybe_infinite_iter`]: https://rust-lang.github.io/rust-clippy/master/index.html#maybe_infinite_iter
13581358
[`mem_discriminant_non_enum`]: https://rust-lang.github.io/rust-clippy/master/index.html#mem_discriminant_non_enum

clippy_lints/src/lib.rs

+5-5
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;
@@ -630,7 +630,7 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
630630
&map_clone::MAP_CLONE,
631631
&map_unit_fn::OPTION_MAP_UNIT_FN,
632632
&map_unit_fn::RESULT_MAP_UNIT_FN,
633-
&match_vec_item::MATCH_VEC_ITEM,
633+
&match_on_vec_items::MATCH_ON_VEC_ITEMS,
634634
&matches::INFALLIBLE_DESTRUCTURING_MATCH,
635635
&matches::MATCH_AS_REF,
636636
&matches::MATCH_BOOL,
@@ -1062,7 +1062,7 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
10621062
store.register_late_pass(|| box future_not_send::FutureNotSend);
10631063
store.register_late_pass(|| box utils::internal_lints::CollapsibleCalls);
10641064
store.register_late_pass(|| box if_let_mutex::IfLetMutex);
1065-
store.register_late_pass(|| box match_vec_item::MatchVecItem);
1065+
store.register_late_pass(|| box match_on_vec_items::MatchOnVecItems);
10661066

10671067
store.register_group(true, "clippy::restriction", Some("clippy_restriction"), vec![
10681068
LintId::of(&arithmetic::FLOAT_ARITHMETIC),
@@ -1280,7 +1280,7 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
12801280
LintId::of(&map_clone::MAP_CLONE),
12811281
LintId::of(&map_unit_fn::OPTION_MAP_UNIT_FN),
12821282
LintId::of(&map_unit_fn::RESULT_MAP_UNIT_FN),
1283-
LintId::of(&match_vec_item::MATCH_VEC_ITEM),
1283+
LintId::of(&match_on_vec_items::MATCH_ON_VEC_ITEMS),
12841284
LintId::of(&matches::INFALLIBLE_DESTRUCTURING_MATCH),
12851285
LintId::of(&matches::MATCH_AS_REF),
12861286
LintId::of(&matches::MATCH_BOOL),
@@ -1473,7 +1473,7 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
14731473
LintId::of(&loops::WHILE_LET_ON_ITERATOR),
14741474
LintId::of(&main_recursion::MAIN_RECURSION),
14751475
LintId::of(&map_clone::MAP_CLONE),
1476-
LintId::of(&match_vec_item::MATCH_VEC_ITEM),
1476+
LintId::of(&match_on_vec_items::MATCH_ON_VEC_ITEMS),
14771477
LintId::of(&matches::INFALLIBLE_DESTRUCTURING_MATCH),
14781478
LintId::of(&matches::MATCH_BOOL),
14791479
LintId::of(&matches::MATCH_OVERLAPPING_ARM),

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

+5-5
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

+7-7
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

+1-1
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

+9-9
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)