Rename instances of array_indexing

This commit renames instances of `array_indexing` to `indexing_slicing` and moves the `indexing_slicing` lint to the `clippy_pedantic` group. The justification for this commit's changes are detailed in the previous commit's message.
This commit is contained in:
Shea Newton 2018-05-22 22:02:07 -07:00
parent 7af0c67855
commit 5b759efa4c
No known key found for this signature in database
GPG key ID: 17EB9122DC958643
4 changed files with 44 additions and 45 deletions

View file

@ -3,7 +3,7 @@
use crate::consts::{constant, Constant};
use crate::utils::higher::Range;
use crate::utils::{self, higher};
use rustc::hir;
use rustc::hir::*;
use rustc::lint::*;
use rustc::ty;
use syntax::ast::RangeLimits;

View file

@ -6,7 +6,7 @@
#![feature(stmt_expr_attributes)]
#![feature(range_contains)]
#![feature(macro_vis_matcher)]
#![allow(unknown_lints, indexing_slicing, shadow_reuse, missing_docs_in_private_items)]
#![allow(unknown_lints, shadow_reuse, missing_docs_in_private_items)]
#![recursion_limit = "256"]
#![allow(stable_features)]
#![feature(iterator_find_map)]
@ -99,7 +99,6 @@ pub mod utils;
// begin lints modules, do not remove this comment, its used in `update_lints`
pub mod approx_const;
pub mod arithmetic;
pub mod array_indexing;
pub mod assign_ops;
pub mod attrs;
pub mod bit_mask;
@ -139,6 +138,7 @@ pub mod identity_conversion;
pub mod identity_op;
pub mod if_let_redundant_pattern_matching;
pub mod if_not_else;
pub mod indexing_slicing;
pub mod infallible_destructuring_match;
pub mod infinite_iter;
pub mod inherent_impl;
@ -355,8 +355,7 @@ pub fn register_plugins(reg: &mut rustc_plugin::Registry) {
);
reg.register_late_lint_pass(box escape::Pass{too_large_for_stack: conf.too_large_for_stack});
reg.register_early_lint_pass(box misc_early::MiscEarly);
reg.register_late_lint_pass(box array_indexing::IndexingSlicingPass);
reg.register_late_lint_pass(box panic::Pass);
reg.register_late_lint_pass(box panic_unimplemented::Pass);
reg.register_late_lint_pass(box strings::StringLitAsBytes);
reg.register_late_lint_pass(box derive::Derive);
reg.register_late_lint_pass(box types::CharLitAsU8);
@ -432,12 +431,11 @@ pub fn register_plugins(reg: &mut rustc_plugin::Registry) {
reg.register_late_lint_pass(box unwrap::Pass);
reg.register_late_lint_pass(box duration_subsec::DurationSubsec);
reg.register_late_lint_pass(box default_trait_access::DefaultTraitAccess);
reg.register_late_lint_pass(box indexing_slicing::IndexingSlicingPass);
reg.register_lint_group("clippy_restriction", vec![
arithmetic::FLOAT_ARITHMETIC,
arithmetic::INTEGER_ARITHMETIC,
array_indexing::INDEXING_SLICING,
assign_ops::ASSIGN_OPS,
else_if_without_else::ELSE_IF_WITHOUT_ELSE,
inherent_impl::MULTIPLE_INHERENT_IMPL,
@ -468,6 +466,7 @@ pub fn register_plugins(reg: &mut rustc_plugin::Registry) {
enum_variants::PUB_ENUM_VARIANT_NAMES,
enum_variants::STUTTER,
if_not_else::IF_NOT_ELSE,
indexing_slicing::INDEXING_SLICING,
infinite_iter::MAYBE_INFINITE_ITER,
items_after_statements::ITEMS_AFTER_STATEMENTS,
matches::SINGLE_MATCH_ELSE,
@ -500,7 +499,7 @@ pub fn register_plugins(reg: &mut rustc_plugin::Registry) {
reg.register_lint_group("clippy", vec![
approx_const::APPROX_CONSTANT,
array_indexing::OUT_OF_BOUNDS_INDEXING,
indexing_slicing::OUT_OF_BOUNDS_INDEXING,
assign_ops::ASSIGN_OP_PATTERN,
assign_ops::MISREFACTORED_ASSIGN_OP,
attrs::DEPRECATED_SEMVER,
@ -863,7 +862,7 @@ pub fn register_plugins(reg: &mut rustc_plugin::Registry) {
reg.register_lint_group("clippy_correctness", vec![
approx_const::APPROX_CONSTANT,
array_indexing::OUT_OF_BOUNDS_INDEXING,
indexing_slicing::OUT_OF_BOUNDS_INDEXING,
attrs::DEPRECATED_SEMVER,
attrs::USELESS_ATTRIBUTE,
bit_mask::BAD_BIT_MASK,

View file

@ -1,5 +1,5 @@
error: indexing may panic. Consider using `.get(n)` or `.get_mut(n)` instead
--> $DIR/array_indexing.rs:11:5
--> $DIR/indexing_slicing.rs:11:5
|
11 | x[index];
| ^^^^^^^^
@ -7,37 +7,37 @@ error: indexing may panic. Consider using `.get(n)` or `.get_mut(n)` instead
= note: `-D indexing-slicing` implied by `-D warnings`
error: slicing may panic. Consider using `.get(n..m)` or `.get_mut(n..m)` instead
--> $DIR/array_indexing.rs:12:6
--> $DIR/indexing_slicing.rs:12:6
|
12 | &x[index_from..index_to];
| ^^^^^^^^^^^^^^^^^^^^^^^
error: slicing may panic. Consider using `.get(..n)`or `.get_mut(..n)` instead
--> $DIR/array_indexing.rs:13:6
--> $DIR/indexing_slicing.rs:13:6
|
13 | &x[index_from..][..index_to];
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: slicing may panic. Consider using `.get(n..)` or .get_mut(n..)` instead
--> $DIR/array_indexing.rs:13:6
--> $DIR/indexing_slicing.rs:13:6
|
13 | &x[index_from..][..index_to];
| ^^^^^^^^^^^^^^^
error: slicing may panic. Consider using `.get(n..)` or .get_mut(n..)` instead
--> $DIR/array_indexing.rs:14:6
--> $DIR/indexing_slicing.rs:14:6
|
14 | &x[index..];
| ^^^^^^^^^^
error: slicing may panic. Consider using `.get(..n)`or `.get_mut(..n)` instead
--> $DIR/array_indexing.rs:15:6
--> $DIR/indexing_slicing.rs:15:6
|
15 | &x[..index];
| ^^^^^^^^^^
error: const index is out of bounds
--> $DIR/array_indexing.rs:18:5
--> $DIR/indexing_slicing.rs:18:5
|
18 | x[4];
| ^^^^
@ -45,175 +45,175 @@ error: const index is out of bounds
= note: `-D out-of-bounds-indexing` implied by `-D warnings`
error: range is out of bounds
--> $DIR/array_indexing.rs:20:6
--> $DIR/indexing_slicing.rs:20:6
|
20 | &x[1..5];
| ^^^^^^^
error: slicing may panic. Consider using `.get(n..m)` or `.get_mut(n..m)` instead
--> $DIR/array_indexing.rs:20:6
--> $DIR/indexing_slicing.rs:20:6
|
20 | &x[1..5];
| ^^^^^^^
error: slicing may panic. Consider using `.get(..n)`or `.get_mut(..n)` instead
--> $DIR/array_indexing.rs:21:6
--> $DIR/indexing_slicing.rs:21:6
|
21 | &x[1..][..5];
| ^^^^^^^^^^^
error: slicing may panic. Consider using `.get(..n)`or `.get_mut(..n)` instead
--> $DIR/array_indexing.rs:23:6
--> $DIR/indexing_slicing.rs:23:6
|
23 | &x[0..][..3];
| ^^^^^^^^^^^
error: range is out of bounds
--> $DIR/array_indexing.rs:25:6
--> $DIR/indexing_slicing.rs:25:6
|
25 | &x[..=4];
| ^^^^^^^
error: slicing may panic. Consider using `.get(..n)`or `.get_mut(..n)` instead
--> $DIR/array_indexing.rs:25:6
--> $DIR/indexing_slicing.rs:25:6
|
25 | &x[..=4];
| ^^^^^^^
error: range is out of bounds
--> $DIR/array_indexing.rs:29:6
--> $DIR/indexing_slicing.rs:29:6
|
29 | &x[5..];
| ^^^^^^
error: slicing may panic. Consider using `.get(n..)` or .get_mut(n..)` instead
--> $DIR/array_indexing.rs:29:6
--> $DIR/indexing_slicing.rs:29:6
|
29 | &x[5..];
| ^^^^^^
error: range is out of bounds
--> $DIR/array_indexing.rs:31:6
--> $DIR/indexing_slicing.rs:31:6
|
31 | &x[..5];
| ^^^^^^
error: slicing may panic. Consider using `.get(..n)`or `.get_mut(..n)` instead
--> $DIR/array_indexing.rs:31:6
--> $DIR/indexing_slicing.rs:31:6
|
31 | &x[..5];
| ^^^^^^
error: indexing may panic. Consider using `.get(n)` or `.get_mut(n)` instead
--> $DIR/array_indexing.rs:34:5
--> $DIR/indexing_slicing.rs:34:5
|
34 | y[0];
| ^^^^
error: slicing may panic. Consider using `.get(n..m)` or `.get_mut(n..m)` instead
--> $DIR/array_indexing.rs:35:6
--> $DIR/indexing_slicing.rs:35:6
|
35 | &y[1..2];
| ^^^^^^^
error: slicing may panic. Consider using `.get(..n)`or `.get_mut(..n)` instead
--> $DIR/array_indexing.rs:38:6
--> $DIR/indexing_slicing.rs:38:6
|
38 | &y[..=4];
| ^^^^^^^
error: const index is out of bounds
--> $DIR/array_indexing.rs:41:5
--> $DIR/indexing_slicing.rs:41:5
|
41 | empty[0];
| ^^^^^^^^
error: range is out of bounds
--> $DIR/array_indexing.rs:42:6
--> $DIR/indexing_slicing.rs:42:6
|
42 | &empty[1..5];
| ^^^^^^^^^^^
error: slicing may panic. Consider using `.get(n..m)` or `.get_mut(n..m)` instead
--> $DIR/array_indexing.rs:42:6
--> $DIR/indexing_slicing.rs:42:6
|
42 | &empty[1..5];
| ^^^^^^^^^^^
error: range is out of bounds
--> $DIR/array_indexing.rs:44:6
--> $DIR/indexing_slicing.rs:44:6
|
44 | &empty[..=4];
| ^^^^^^^^^^^
error: slicing may panic. Consider using `.get(..n)`or `.get_mut(..n)` instead
--> $DIR/array_indexing.rs:44:6
--> $DIR/indexing_slicing.rs:44:6
|
44 | &empty[..=4];
| ^^^^^^^^^^^
error: range is out of bounds
--> $DIR/array_indexing.rs:49:6
--> $DIR/indexing_slicing.rs:49:6
|
49 | &empty[..=0];
| ^^^^^^^^^^^
error: slicing may panic. Consider using `.get(..n)`or `.get_mut(..n)` instead
--> $DIR/array_indexing.rs:49:6
--> $DIR/indexing_slicing.rs:49:6
|
49 | &empty[..=0];
| ^^^^^^^^^^^
error: range is out of bounds
--> $DIR/array_indexing.rs:51:6
--> $DIR/indexing_slicing.rs:51:6
|
51 | &empty[1..];
| ^^^^^^^^^^
error: slicing may panic. Consider using `.get(n..)` or .get_mut(n..)` instead
--> $DIR/array_indexing.rs:51:6
--> $DIR/indexing_slicing.rs:51:6
|
51 | &empty[1..];
| ^^^^^^^^^^
error: range is out of bounds
--> $DIR/array_indexing.rs:52:6
--> $DIR/indexing_slicing.rs:52:6
|
52 | &empty[..4];
| ^^^^^^^^^^
error: slicing may panic. Consider using `.get(..n)`or `.get_mut(..n)` instead
--> $DIR/array_indexing.rs:52:6
--> $DIR/indexing_slicing.rs:52:6
|
52 | &empty[..4];
| ^^^^^^^^^^
error: indexing may panic. Consider using `.get(n)` or `.get_mut(n)` instead
--> $DIR/array_indexing.rs:55:5
--> $DIR/indexing_slicing.rs:55:5
|
55 | v[0];
| ^^^^
error: indexing may panic. Consider using `.get(n)` or `.get_mut(n)` instead
--> $DIR/array_indexing.rs:56:5
--> $DIR/indexing_slicing.rs:56:5
|
56 | v[10];
| ^^^^^
error: slicing may panic. Consider using `.get(n..m)` or `.get_mut(n..m)` instead
--> $DIR/array_indexing.rs:57:6
--> $DIR/indexing_slicing.rs:57:6
|
57 | &v[10..100];
| ^^^^^^^^^^
error: slicing may panic. Consider using `.get(n..)` or .get_mut(n..)` instead
--> $DIR/array_indexing.rs:58:6
--> $DIR/indexing_slicing.rs:58:6
|
58 | &v[10..];
| ^^^^^^^
error: slicing may panic. Consider using `.get(..n)`or `.get_mut(..n)` instead
--> $DIR/array_indexing.rs:59:6
--> $DIR/indexing_slicing.rs:59:6
|
59 | &v[..100];
| ^^^^^^^^