Commit graph

4020 commits

Author SHA1 Message Date
Mazdak Farrokhzad
7b6dc7b33d
add unnested_or_patterns lint 2020-06-07 21:09:47 +02:00
flip1995
1a8a69d012
Merge remote-tracking branch 'upstream/master' into rustup 2020-06-07 02:17:49 +02:00
Ralf Jung
161474b7f7 Rollup merge of #72508 - ecstatic-morse:poly-self-ty, r=nikomatsakis
Make `PolyTraitRef::self_ty` return `Binder<Ty>`

This came up during review of #71618. The current implementation is the same as a call to `skip_binder` but harder to audit. Make it preserve binding levels and add a call to `skip_binder` at all use sites so they can be audited as part of #72507.
2020-06-06 21:57:38 +02:00
Philipp Hansch
623faac84e
Cleanup: Use rustc's same_types instead of our same_tys 2020-06-06 11:50:59 +02:00
bors
b059c0a2e6 Auto merge of #72927 - petrochenkov:rustc, r=Mark-Simulacrum
Rename all remaining compiler crates to use the `rustc_foo` pattern

libarena -> librustc_arena
libfmt_macros -> librustc_parse_format
libgraphviz -> librustc_graphviz
libserialize -> librustc_serialize

Closes https://github.com/rust-lang/rust/issues/71177 in particular.
2020-06-06 09:00:51 +00:00
Eduardo Broto
413713c884 Add error info when cargo metadata fails to run 2020-06-05 22:28:58 +02: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
Mark Rousskov
0c470b3339 Bump to 1.46 2020-06-03 15:27:51 -04:00
Lzu Tao
b39fd5f62f Fix false negative of checked_conversion lint 2020-06-03 09:04:24 +07:00
Vadim Petrochenkov
bd3fc11416 Update fulldeps tests and clippy 2020-06-03 00:18:57 +03:00
Vadim Petrochenkov
2b79413491 Rename the crates in source code 2020-06-02 20:42:54 +03: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
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
Dylan MacKenzie
ea06c72fdd Call skip_binder or no_bound_vars before self_ty 2020-06-01 12:18:57 -07: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
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
Ericko Samudera
32fde0b511 New lint: iter_next_slice 2020-06-01 03:08:51 +07: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
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
flip1995
a9cde3a804
Don't suggest to move empty blocks 2020-05-31 19:29:03 +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
0ab823c509
Rework suggestion generation of unit_arg lint 2020-05-31 18:47:48 +02:00
Michael Wright
6122612232 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.
2020-05-31 17:38:59 +02:00
bors
8aa8f42556 Auto merge of #5667 - djugei:master, r=flip1995
moved cast_ptr_alignment to pedantic and expanded documentation

fixes: #5618
changelog: cast_ptr_alignment moved to pedantic
2020-05-31 14:26:03 +00:00
djugei
18b5ceed79
ran update_lints 2020-05-31 16:00:29 +02:00
djugei
0bcfae92f8
moved cast_ptr_alignment to pedantic and expanded documentation 2020-05-31 15:41:33 +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