Commit graph

20 commits

Author SHA1 Message Date
Yuki Okushi
7c5785ca2b Split up indexing_slicing ui test 2020-02-03 15:09:17 +09:00
Matthias Krüger
907078a8f8 rustup https://github.com/rust-lang/rust/pull/67130 2019-12-21 15:13:22 +01:00
flip1995
e3a74ed2b5
Set mir_opt_level=0
This introduces some FNs. But a building Clippy is more important for now
2019-11-22 14:25:44 +01:00
Matthias Krüger
deb586a0c6 rustup https://github.com/rust-lang/rust/pull/62764
(was merged as part of https://github.com/rust-lang/rust/pull/62782 )
2019-07-19 00:35:32 +02:00
Philipp Hansch
38b6156a51
Update UI tests 2019-07-16 22:26:47 +02:00
Philipp Hansch
33010ae7e6
UI Test Cleanup: Split out out_of_bounds_indexing
This moves the `out_of_bounds_indexing` lint tests to their own
directory.
2019-07-16 07:30:23 +02:00
Philipp Hansch
38d4ac7cea
Remove all copyright license headers
Discussion previously happened in https://github.com/rust-lang/rust/pull/43498
2019-01-08 21:46:39 +01:00
flip1995
d2dbd0b8a5
Update *.stderr files 2018-12-28 12:41:12 +01:00
Matthias Krüger
7bcc2cd9c8 update test stderr 2018-12-10 08:22:07 +01:00
Shotaro Yamada
105ae712f4 update_references indexing_slicing 2018-10-26 01:16:14 +09:00
Josh Mcguigan
66d3672b26 out_of_bounds_indexing improved reporting of out of bounds value 2018-10-15 04:44:39 -07:00
Josh Mcguigan
0f3345e8b2 OUT_OF_BOUNDS_INDEXING fix #3102 false negative 2018-10-13 13:51:53 -07:00
Manish Goregaokar
e9c025ea70 Add license header to Rust files 2018-10-06 09:43:08 -07:00
flip1995
e9af09c274 Adapt the *.stderr files of the ui-tests to the tool_lints 2018-08-29 11:08:29 -07:00
Shea Newton
c479b3bc28
Removing lint for constant usize array indexing
This commit removes the logic in this PR that linted out-of-bounds constant `usize` indexing on arrays. That case is already handled by rustc's `const_err` lint. Beyond removing the linting logic, the test file and its associated stderr were updated to verify that const `usize` indexing operations on arrays are no longer handled by this `indexing_slicing` lint.
2018-06-19 21:30:43 +00:00
Shea Newton
e63f5dfedb
Add tests that index with a const value.
In this commit tests were added to ensure that tests with a `const` index behaved as expected.
In order to minimize the changes to the test's corresponding `stderr`, the tests were appended to
the end of the file.
2018-06-19 16:28:10 +00:00
Shea Newton
4ec439bef0
Revisiting indexing_slicing test cases
This commit contains a few changes. In an attempt to clarify which test cases should and should not produce stderr it became clear that some cases were being handled incorrectly. In order to address these test cases, a minor re-factor was made to the linting logic itself.

The re-factor was driven by edge case handling including a need for additional match conditions for `ExprCall` (`&x[0..=4]`) and `ExprBinary` (`x[1 << 3]`). Rather than attempt to account for each potential `Expr*` the code was re-factored into simply "if ranged index" and an "otherwise" conditions.
2018-06-19 16:28:10 +00:00
Shea Newton
8b59542acc
Second pass at addressing changes requested
The changes reflected in this commit (requested in PR #2790) are as follows:

- Extended `INDEXING_SLICING` documentation to include the array type so that it is clearer when indexing operations are allowed.
- Variable `ty` defined identically in multiple scopes was moved to an outer scope so it's only defined once.
- Added a missing return statement to ensure only one lint is triggered by a scenario.
- Prettified match statement with a `let` clause. (I learned something new!)
- Added `&x[5..].iter().map(|x| 2 * x).collect::<Vec<i32>>()` and `&x[2..].iter().map(|x| 2 * x).collect::<Vec<i32>>()` to the test cases. The first _should trigger the lint/stderr_ and the second _should not_.
2018-06-19 16:28:10 +00:00
Shea Newton
a7c0ff3fa6
This commit represents an attempt to address changes requested in the process of reviewing PR #2790.
The changes reflected in this commit are as follows:

- Revised `IndexingSlicingPass` struct name to IndexingSlicing for consistency with the rest of the code base.
- Revised match arm condition to use `(..)` shorthand in favor of `(_, _, _)`.
- Restored a couple telling variable names.
- Calls to `cx.span_lint` were revised to use `utils::span_help_and_lint`.
- Took a stab at refactoring some generalizable calls to `utils::span_help_and_lint` to minimize duplicate code.
- Revised INDEXING_SLICING declaration to pedantic rather than restriction.
- Added `&x[0..].get(..3)` to the test cases.
2018-06-19 16:28:10 +00:00
Shea Newton
5b759efa4c
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.
2018-06-19 16:27:39 +00:00
Renamed from tests/ui/array_indexing.stderr (Browse further)