Commit graph

3231 commits

Author SHA1 Message Date
Eduardo Broto
a7743e9084 redundant_pattern_matching: avoid non-const fn in const context 2020-06-17 00:32:47 +02:00
Devin R
e521a4ed38 Add enough attrs to the test file so the fix compiles with no errors, fmt/clippy 2020-06-09 16:39:31 -04:00
Devin R
288df59b25 Fix suggestion output, add run-rustfix to test file, stop sorting import segments duh 2020-06-08 16:00:33 -04:00
Devin R
8c5a5a92ec cleaned up import suggestion formatter, look into code reuse with wildcard impotrs 2020-06-08 16:00:33 -04:00
Devin R
d4f60b5ff4 wip: of handling nested import paths for multi-macro paths 2020-06-08 16:00:33 -04:00
Devin R
8bc106b29d fix some of the review, rename, fmt, refactor 2020-06-08 16:00:33 -04:00
Devin R
8ffbf6f94d use hashset not map for keeping track of seen macro refs
remove stdout, fix clippy warnings, fmtcar
2020-06-08 16:00:33 -04:00
Devin R
ede366be63 collected all the imports and names
how to compare macro to import path

add more imports to test
2020-06-08 16:00:30 -04:00
Devin R
a4b8bb88f2 warn on macro_use attr
cargo dev update lints

use if_chain

clean up alot, span_lint_and_sugg

find imported macros for sugg
2020-06-08 15:59:41 -04:00
bors
ff0993c5e9 Auto merge of #5692 - ebroto:5689_N_dotdot_N, r=yaahc
reversed_empty_ranges: avoid linting N..N except in for loop arguments

changelog: [`reversed_empty_ranges`]: avoid linting N..N except in for loop arguments

r? @yaahc
Fixes #5689
2020-06-08 17:15:45 +00:00
bors
f947644f0d Auto merge of #5680 - ebroto:3792_let_return, r=Manishearth
let_and_return: avoid "does not live long enough" errors

EDIT: Add #3324 to the list of fixes

<details>
<summary>Description of old impl</summary>
<br>
Avoid suggesting turning the RHS expression of the last statement into the block tail expression if a temporary borrows from a local that would be destroyed before.

This is my first incursion into MIR so there's probably room for improvement!
</details>

Avoid linting if the return type of some method or function called in the last statement has a lifetime parameter.

changelog: Fix false positive in [`let_and_return`]

Fixes #3792
Fixes #3324
2020-06-08 16:47:22 +00:00
Mazdak Farrokhzad
d6136b92a2
split unnested_or_patterns test 2020-06-07 21:16:05 +02:00
Mazdak Farrokhzad
7b6dc7b33d
add unnested_or_patterns lint 2020-06-07 21:09:47 +02:00
Eduardo Broto
ebfc1da07d reversed_empty_ranges: don't lint N..N except in for loop arg 2020-06-07 21:03:08 +02:00
Eduardo Broto
dac8a3c1ca let_and_return: do not lint if last statement borrows 2020-06-07 20:53:38 +02:00
Eduardo Broto
9c205d7b1b Rename let_and_return test for consistency with the lint name 2020-06-07 20:53:38 +02:00
flip1995
5bdbc45ae5
Rustup to rust-lang/rust#71796 2020-06-07 03:07:48 +02:00
Eduardo Broto
c325c120c2 Fix cargo ui tests when running inside rust repo 2020-06-05 22:30:14 +02:00
Lzu Tao
b39fd5f62f Fix false negative of checked_conversion lint 2020-06-03 09:04:24 +07:00
bors
153ef1c76f Auto merge of #5672 - phansch:regression-test-env, r=yaahc
Add regression test for `string_lit_as_bytes` issue

Closes #5619

Before the fix in https://github.com/rust-lang/rust/pull/72637, `string_lit_as_bytes` was incorrectly triggering on the `env!` macro. With the fix merged, this test makes sure that the lint is not triggering anymore.

changelog: none
2020-06-02 12:40:20 +00:00
bors
f760d77bdb Auto merge of #5597 - esamudera:slice_iter_next, r=flip1995
New lint: iter_next_slice

Hello, this is a work-in-progress PR for issue: https://github.com/rust-lang/rust-clippy/issues/5572

I have implemented lint to replace `iter().next()` for `slice[index..]` and `array` with `get(index)` and `get(0)` respectively. However since I made a lot of changes, I would like to request some feedback before continuing so that I could fix mistakes.

Thank you!

---

changelog: implement `iter_next_slice` lint and test, and modify `needless_continues`, `for_loop_over_options_result` UI tests since they have `iter().next()`
2020-06-02 11:42:22 +00:00
bors
bfafb8e0d6 Auto merge of #5673 - phansch:endless-loop, r=Manishearth
Add regression test for endless loop / update `pulldown_cmark`

Closes #4917

This was fixed in pulldown_cmark 0.7.1, specifically raphlinus/pulldown-cmark#438

changelog: none
2020-06-01 17:16:06 +00:00
Philipp Hansch
861b897c54
Add regression test for endless loop
This was fixed in pulldown_cmark 0.7.1, specifically
https://github.com/raphlinus/pulldown-cmark/pull/438
2020-06-01 10:20:17 +02:00
Philipp Hansch
ae0ce2255a
Add regression test for string_lit_as_bytes issue 2020-06-01 09:58:42 +02:00
bors
bee0608fad Auto merge of #5623 - JarredAllen:sort_by_key_reverse, r=phansch
New lint: Use Reverse with sort_by_key

Implements  #5578

changelog: New lint: [`unnecessary_sort_by`]
2020-06-01 07:43:16 +00:00
JarredAllen
9a5baed482 Implement suggestions from phansch 2020-05-31 15:09:12 -07:00
Ericko Samudera
32fde0b511 New lint: iter_next_slice 2020-06-01 03:08:51 +07:00
bors
9f9877c47f Auto merge of #5662 - ebroto:cargo_tests_invalid_crate, r=flip1995
cargo-ui tests: check that <dir>/src exists before processing test

I forgot that I had fixed this in a PR I closed some days ago (#5643).

Before this change, cargo UI tests could fail when switching between branches if the previous branch had a test that the current branch does not have. The directory is not removed when switching because an ignored `Cargo.lock` file exists, and the code was trying to reach `$DIR/src` unconditionally.

This change will just skip a directory that has no `src` subdirectory.

changelog: none
2020-05-31 19:12:00 +00:00
JarredAllen
20cb512e81 Updated test cases and formatted 2020-05-31 12:06:32 -07:00
JarredAllen
015ab9f925 Renamed to 2020-05-31 11:55:45 -07:00
JarredAllen
07886a9764 Detect also when works 2020-05-31 11:55:45 -07:00
JarredAllen
059e8edd15 Detect also a non-reversed comparison 2020-05-31 11:55:45 -07:00
JarredAllen
955a25ee7d Added negative test cases and ran cargo dev fmt 2020-05-31 11:55:45 -07:00
JarredAllen
943cb94dce Passes all tests now! 2020-05-31 11:55:45 -07:00
JarredAllen
8590ab4d46 More progress towards sort_by_key_reverse lint 2020-05-31 11:55:45 -07:00
JarredAllen
24847ea53e Attempted start at sort_by_key_reverse lint 2020-05-31 11:55:45 -07:00
JarredAllen
7e843515d9 Created lint 2020-05-31 11:55:45 -07:00
Eduardo Broto
14e9100543 cargo-ui tests: check that <dir>/src exists before processing test 2020-05-31 20:38:48 +02:00
flip1995
77dd0ea62a
Add tests for empty blocks 2020-05-31 19:29:36 +02:00
flip1995
6d15a14964
Update test files 2020-05-31 18:50:33 +02:00
flip1995
380d941a04
Adapt stderr and fixed files 2020-05-31 18:48:28 +02:00
Philipp Krones
00c656d8ee
Rollup merge of #5663 - matthiaskrgr:crash_test_3969, r=Manishearth
add testcase that no longer ICEs

Fixes #3969

changelog: none
2020-05-31 14:57:34 +02:00
Philipp Krones
873c9fc8f2
Rollup merge of #5656 - ebroto:len_zero_ranges, r=matthiaskrgr
len_zero: skip ranges if feature `range_is_empty` is not enabled

If the feature is not enabled, calling `is_empty()` on a range is ambiguous. Moreover, the two possible resolutions are unstable methods, one inherent to the range and the other being part of the `ExactSizeIterator` trait.

Since `len_zero` only checks for existing `is_empty()` inherent methods, we only take into account the `range_is_empty` feature.

Related: https://github.com/rust-lang/rust/issues/48111#issuecomment-445132965

changelog: len_zero: avoid linting ranges without #![feature(range_is_empty)]

Fixes: #3807
2020-05-31 14:57:33 +02:00
Philipp Krones
0fff522071
Rollup merge of #5637 - montrivo:feature/vec_resize_to_zero, r=yaahc,flip1995
new lint: vec_resize_to_zero

implements #5444

changelog: new lint vec_resize_to_zero
2020-05-31 14:57:32 +02:00
flip1995
37381d33a4
Fix sync fallout 2020-05-31 14:05:57 +02:00
Tim Nielens
5faab874f9 new lint: vec_resize_to_zero 2020-05-30 17:52:10 +02:00
Matthias Krüger
b92cc8a08d add testcase that no longer ICEs
Fixes #3969
2020-05-29 22:52:24 +02:00
flip1995
b6c58f0d72 Temp fix: don't run cargo lint tests in rustc test suite 2020-05-28 17:19:30 +02:00
flip1995
a0e9f9bd0d Merge commit '7ea7cd165ad6705603852771bf82cc2fd6560db5' into clippyup2 2020-05-28 15:45:24 +02:00
Eduardo Broto
64a05f56c3 len_zero: skip ranges if feature range_is_empty is not enabled 2020-05-28 00:58:48 +02:00