Shea Newton
7af0c67855
Extend indexing_slicing
lint
...
Hey there clippy team! I've made some assumptions in this PR and I'm not at all certain they'll look like the right approach to you. I'm looking forward to any feedback or revision requests you have, thanks!
Prior to this commit the `indexing_slicing` lint was limited to indexing/slicing operations on arrays. This meant that the scope of a really useful lint didn't include vectors. In order to include vectors in the `indexing_slicing` lint a few steps were taken.
The `array_indexing.rs` source file in `clippy_lints` was renamed to `indexing_slicing.rs` to more accurately reflect the lint's new scope. The `OUT_OF_BOUNDS_INDEXING` lint persists through these changes so if we can know that a constant index or slice on an array is in bounds no lint is triggered.
The `array_indexing` tests in the `tests/ui` directory were also extended and moved to `indexing_slicing.rs` and `indexing_slicing.stderr`.
The `indexing_slicing` lint was moved to the `clippy_pedantic` lint group.
A specific "Consider using" string was added to each of the `indexing_slicing` lint reports.
At least one of the test scenarios might look peculiar and I'll leave it up to y'all to decide if it's palatable. It's the result of indexing the array `x` after `let x = [1, 2, 3, 4];`
```
error: slicing may panic. Consider using `.get(..n)`or `.get_mut(..n)`instead
--> $DIR/indexing_slicing.rs:23:6
|
23 | &x[0..][..3];
| ^^^^^^^^^^^
```
The error string reports only on the second half's range-to, because the range-from is in bounds!
Again, thanks for taking a look.
Closes #2536
2018-06-19 16:27:08 +00:00
Oliver Schneider
c573186245
Merge pull request #2855 from uHOOCCOOHu/impl-fn-lifetime
...
Fix false positive `unused_lifetime` when referenced in generic bounds.
2018-06-19 18:00:21 +02:00
uHOOCCOOHu
5b57b5fc61
Add notes for test examples.
2018-06-19 23:18:53 +08:00
uHOOCCOOHu
ce1800d599
Check lifetimes in Fn traits in generic bounds.
...
Add tests.
2018-06-19 21:25:38 +08:00
Oliver Schneider
d761ba78d8
Merge pull request #2837 from fanzier/panicking_unwrap
...
Implement lint checking for `unwrap`s that will always panic.
2018-06-19 13:30:38 +02:00
Oliver Schneider
4839c790ae
Merge pull request #2844 from illicitonion/default_trait_access
...
Add default_trait_access lint
2018-06-19 10:10:20 +02:00
Oliver Schneider
7d672888fe
Version bump
2018-06-19 09:56:37 +02:00
Daniel Wagner-Hall
b24d75313e
Exclude generated code
2018-06-18 10:29:25 +01:00
Oliver Schneider
d3b862f9d7
Bump min_version.txt
2018-06-18 10:48:24 +02:00
Oliver Schneider
1a6ae4e396
Merge pull request #2851 from mati865/master
...
Version bump
2018-06-18 01:43:42 -07:00
Mateusz Mikuła
8625cfb988
Version bump
2018-06-18 09:56:58 +02:00
Oliver Schneider
45bab501e1
Fix typo in lint dump script
2018-06-15 17:45:52 +02:00
Philipp Krones
3d3d3732c0
Merge pull request #2803 from Nemo157/trivially_copy_pass_by_ref
...
New Lint: Pass small trivially copyable objects by value
2018-06-15 17:44:44 +02:00
Wim Looman
621fdcc3bc
Dogfood new trivially_copy_pass_by_ref lint
2018-06-15 16:53:34 +02:00
Wim Looman
700ece5648
Allow configuring the trivial copy size limit
2018-06-15 16:53:34 +02:00
Wim Looman
7547a4ddef
New Lint: Pass small trivially copyable objects by value
...
Fixes #1680
Hardcoded for 64-bit "trivial" size for now
2018-06-15 16:53:34 +02:00
Manish Goregaokar
0c23112846
More doc fixes
2018-06-15 00:20:46 -07:00
Manish Goregaokar
00a0efc566
Doc fix syntax
2018-06-15 00:19:19 -07:00
Daniel Wagner-Hall
d3124731b7
Fix some existing test expectations
2018-06-14 23:13:12 +01:00
Oliver Schneider
e38c109ae7
Lint printing was broken
2018-06-14 22:50:07 +02:00
Daniel Wagner-Hall
4866309f9d
Add default_trait_access lint
2018-06-14 09:11:46 +01:00
Oliver Schneider
26bc88d48c
Merge pull request #2839 from mikerite/duration_subsec_pr_2
...
Add duration_subsec lint
2018-06-12 06:30:20 -07:00
Fabian Zaiser
817da4c00a
Fix documentation
2018-06-12 15:06:46 +02:00
Fabian Zaiser
35d1b19a03
Fix markdown.
2018-06-12 15:06:46 +02:00
Fabian Zaiser
8682858e2c
Categorize the unwrap lints correctly.
2018-06-12 15:06:46 +02:00
Fabian Zaiser
0c6730d851
Update known problems.
2018-06-12 15:04:44 +02:00
Fabian Zaiser
23404287fc
Implement lint checking for unwrap
s that will always panic.
2018-06-12 15:04:44 +02:00
Michael Wright
725e9621d0
duration_subsec: Add check for subsec_micros
2018-06-12 08:25:10 +02:00
Oliver Schneider
8f0edba6e9
Merge pull request #2815 from darArch/master
...
Warn if non-trivial work is done inside .expect
2018-06-11 06:33:26 -07:00
Donald Robertson
c6fb47331a
Updating docs to reflect more recent changes to expect_fun_call lint
2018-06-11 14:17:40 +01:00
Michael Wright
2d427ea7ee
Merge branch 'master' into duration_subsec_pr_2
2018-06-11 07:48:10 +02:00
Oliver Schneider
8fe90e41d0
Publish preparation
2018-06-10 06:22:07 +02:00
Michael Wright
b0d364cb3e
duration_subsec: fix declaration; correctly classify
2018-06-09 11:04:21 +02:00
Michael Wright
7b2fa2077f
Add duration_subsec lint
...
Closes #2543
2018-06-09 10:21:26 +02:00
Oliver Schneider
91986fa933
Merge pull request #2836 from mati865/upcoming_breakage
...
Upcoming breakage
2018-06-09 06:56:39 +02:00
Oliver Schneider
d68b8cea15
Merge pull request #2811 from fanzier/checked_unwrap
...
Implement lint that checks for unidiomatic unwrap() (closes #1770 )
2018-06-08 07:15:02 +02:00
Fabian Zaiser
54826cf72e
Address review comments.
2018-06-08 06:02:25 +02:00
Fabian Zaiser
81821acd59
Implement lint that checks for unidiomatic unwrap()
( fixes #1770 )
...
This checks for things like
if x.is_some() {
x.unwrap()
}
which should be written using `if let` or `match` instead.
In the process I moved some logic to determine which variables are
mutated in an expression to utils/usage.rs.
2018-06-08 05:29:25 +02:00
Mateusz Mikuła
b45fb35ec4
Cleanup of driver code
2018-06-07 22:13:24 +02:00
Mateusz Mikuła
3693a4ea53
Formatting
2018-06-07 22:01:46 +02:00
Philipp Hansch
d0620ae4eb
Merge pull request #2835 from FauxFaux/patch-1
...
Tiny typo in rust-update script
2018-06-07 20:00:45 +02:00
Mateusz Mikuła
52deb3b086
Prepare for upcoming breakage
2018-06-07 19:16:41 +02:00
Chris West
e3fd348cd4
Tiny typo in rust-update script
2018-06-07 17:47:11 +01:00
Oliver Schneider
2a2e602f2a
Merge pull request #2833 from phansch/cannot_relate_bound_region_without_ICE_cream
...
Fix cargo late bound region mismatch ICE
2018-06-07 11:52:32 +02:00
Philipp Hansch
17aff1d774
Fix cargo late bound region mismatch ICE
2018-06-07 07:42:45 +02:00
Donald Robertson
e70632215e
Combining if statements per lint warnings on build
2018-06-06 20:38:13 +01:00
Donald Robertson
9c73f7ff18
Amending use of Some with discarded value to use is_some
2018-06-06 17:13:31 +01:00
Donald Robertson
e67d2b2663
Added check to ensure format macro only being handled, refactored extraction and checks to smaller functions.
2018-06-06 16:53:11 +01:00
Oliver Schneider
7563d8155b
Merge pull request #2804 from utaal/expr-call-author
...
Add support for ExprCall in clippy::author
2018-06-06 15:17:47 +02:00
Donald Robertson
451fd5feb9
Extracting arguments to format to pass directly to panic when appropriate
2018-06-05 21:15:08 +01:00