Commit Graph

8669 Commits

Author SHA1 Message Date
flip1995
6b9e2e90bf
Replace all remaining occurrences of submodule with subtree 2020-06-05 14:53:23 +02:00
bors
af9a094d98 Auto merge of #5686 - flip1995:release_doc, r=phansch
Reorder sections of release documentation

r? @phansch

[Rendered](https://github.com/flip1995/rust-clippy/blob/release_doc/doc/release.md)

changelog: none
2020-06-05 12:23:13 +00:00
flip1995
9ef15ae7c8
Reorder sections of release documentation
Before tagging a commit the beta branch has to be remerged
2020-06-05 13:56:07 +02:00
bors
f61840d220 Auto merge of #5685 - flip1995:backport_remerge, r=flip1995
Backport remerge

Part of the release process. Nothing to see here (literally).

d4092ac matches the current HEAD of the beta branch

changelog: none
2020-06-05 11:52:27 +00:00
flip1995
17bdc96646
Merge remote-tracking branch 'upstream/beta' into backport_remerge 2020-06-05 13:50:53 +02:00
bors
a8957acb13 Auto merge of #5681 - matthiaskrgr:empty_line, r=phansch
match_wildcard_for_single_variants: remove empty line at start of lint example.

See https://rust-lang.github.io/rust-clippy/master/index.html#match_wildcard_for_single_variants

changelog: none
2020-06-04 09:23:44 +00:00
Matthias Krüger
7654125d27 match_wildcard_for_single_variants: remove empty line at start of lint example.
See https://rust-lang.github.io/rust-clippy/master/index.html#match_wildcard_for_single_variants

changelog: none
2020-06-04 03:34:22 +02:00
bors
e2fdeecc22 Auto merge of #5677 - lzutao:checked_conv, r=matthiaskrgr
Fix false negative of `checked_conversion` lint

Closes  #5675
changelog: none
2020-06-03 16:06:39 +00:00
Lzu Tao
b39fd5f62f Fix false negative of checked_conversion lint 2020-06-03 09:04:24 +07:00
bors
6c833df69b Auto merge of #5678 - lzutao:slice, r=flip1995
Make use of slice pattern

changelog: none
2020-06-02 16:42:51 +00:00
Lzu Tao
fbf0b84b32 Make use of slice pattern 2020-06-02 21:42:33 +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
5cb9ef390a Auto merge of #5664 - ThibsG:GiveCorrectedCode, r=flip1995
Give corrected code

This PR adds corrected code for doc examples.

I did this in several commits to facilitate review.
Don't hesitate to tell me if I forgot some.
Also, sometimes I felt it was not necessary to give corrected code, but I maybe wrong.

fixes: #4829

changelog: Improve documentation examples across multiple lints.
2020-06-02 12:11:28 +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
ThibsG
137a3b4d32 Corrected doc PR fixes 2020-06-01 10:49:48 +02:00
ThibsG
9893254dff Add more corrected code for doc 2020-06-01 10:39:52 +02:00
ThibsG
19339334cb Give more corrected code examples in doc 2020-06-01 10:39:52 +02:00
ThibsG
262c9dc025 Fix more code examples 2020-06-01 10:39:52 +02:00
ThibsG
61587c9a29 Fix some code examples in doc 2020-06-01 10:39:52 +02: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
b89880a30c Ran update_lints 2020-05-31 15:19:31 -07:00
JarredAllen
9a5baed482 Implement suggestions from phansch 2020-05-31 15:09:12 -07:00
bors
6c008d7e91 Auto merge of #5661 - matthiaskrgr:explain_ra_setup, r=phansch
CONTRIBUTING: explain how to use cargo dev ra-setup

Fixes #5514

Technically this should be merged after https://github.com/rust-lang/rust-clippy/pull/5655 but it's not very important.

---

changelog: none
2020-05-31 21:59:56 +00:00
Matthias Krüger
7727c4ac7f CONTRIBUTING: explain how to use cargo dev ra-setup
Fixes #5514
2020-05-31 23:20:23 +02: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
bors
9fdcb13edb Auto merge of #4455 - flip1995:unit_arg_appl, r=phansch
Rework suggestion generation of `unit_arg` lint

Found this bug while running `cargo fix --clippy` on quite a big codebase:

This would replace something like:
```rust
Some(fn_that_actually_does_something(&a, b))
```
with
```rust
Some(())
```
which obviously suppresses side effects.

Since pretty much every expression could have side effects, I think making this suggestion `MaybeIncorrect` is the best thing to do here.

A correct suggestion would be:

```rust
fn_that_actually_does_something(&a, b);
Some(())
```

Somehow the suggestion is not correctly applied to the arguments, when more than one argument is a unit value. I have to look into this a little more, though.

changelog: Fixes suggestion of `unit_arg` lint, so that it suggests semantic equivalent code

Fixes #4741
2020-05-31 18:01:40 +00:00
bors
fcc3ed2cdc Auto merge of #5669 - mikerite:fix-cargo_metadata-0.9, r=phansch
Increase cargo_metadata version to 0.9.1

`clippy_lints` makes use of `dep_kinds` on `NodeDep` but this was only
added in versoin 0.9.1. Compiling with 0.9.0 will fail because of this.

changelog: none
2020-05-31 17:31:29 +00:00
flip1995
77dd0ea62a
Add tests for empty blocks 2020-05-31 19:29:36 +02:00
flip1995
a9cde3a804
Don't suggest to move empty blocks 2020-05-31 19:29:03 +02:00
flip1995
6d15a14964
Update test files 2020-05-31 18:50:33 +02:00
flip1995
4c9cefa122
Move linting out in its own function 2020-05-31 18:50:33 +02:00
flip1995
f9c325f5b6
Suggest to remove the semicolon of the last stmt in a block 2020-05-31 18:50:33 +02:00
flip1995
0f69cafc2d
Rework suggestion generation and use multipart_suggestion again 2020-05-31 18:50:31 +02:00
flip1995
a1a1a4b82a
Use multiple span_suggestions instead of multipart_suggestion
multipart suggestions aren't autofixable by rustfix yet
2020-05-31 18:48:29 +02:00
flip1995
380d941a04
Adapt stderr and fixed files 2020-05-31 18:48:28 +02:00
flip1995
0ab823c509
Rework suggestion generation of unit_arg lint 2020-05-31 18:47:48 +02:00