Commit Graph

10586 Commits

Author SHA1 Message Date
pro-grammer1
32b2a3f944 Add numeric literals to the write_literal and print_literal tests that shouldn't fail 2021-01-17 19:21:33 +00:00
pro-grammer1
fb2a06dcce Remove numeric literals from print_literal and write_literal tests 2021-01-17 18:55:59 +00:00
pro-grammer1
ab155b14a2 Negate results of matches! 2021-01-17 18:21:58 +00:00
pro-grammer1
2af642da28 Replace another instance of match with matches 2021-01-17 18:01:01 +00:00
bors
91292f1eef Auto merge of #6585 - Daniel-B-Smith:false-positive-issue, r=flip1995
Explicitly document false positives

Adds documentation for known false positives for the `await_holding*` lints.

Issues:

https://github.com/rust-lang/rust-clippy/issues/6353
https://github.com/rust-lang/rust-clippy/issues/6446

changelog: document FPs for the ``await_holding_*`` lints
2021-01-17 17:14:13 +00:00
bors
990e2b35b2 Auto merge of #6528 - Jarcho:redundant_slicing, r=flip1995
New lint: redundant_slicing

changelog: Added lint: `redundant_slicing`
fixes #6519

This will trigger on any type which implements `Index<RangeFull>` that returns the input type. This would be a false positive if the implementation does something other than return itself, but I'm not sure why you would ever want to do that.
2021-01-17 16:26:28 +00:00
bors
e0d331fbf4 Auto merge of #6582 - rail-rain:ice_6539, r=flip1995
Fix the ICE 6539

Fixes #6539

It happened because `zero_sized_map_values` used `layout_of` with types from type aliases, which is essentially the same as the ICE 4968.

---

changelog: Fix an ICE in `zero_sized_map_values`
2021-01-17 15:38:50 +00:00
bors
40ce9f83b6 Auto merge of #6549 - ThibsG:FixClosureNeedlessReturn, r=phansch
Fix FP with empty return for `needless_return` lint

This fixes a false positive in `needless_return` lint, when triggered in a closure using `return` statement without value.

Fixes: #6501

changelog: none
2021-01-17 10:29:10 +00:00
pro-grammer1
0d542b7310 Run tests/ui/update-all-references.sh and refactor match into matches! 2021-01-17 08:48:37 +00:00
Jack Huey
e73b8dcbca Review changes 2021-01-16 18:56:37 -05:00
Jack Huey
82569601f2 Cleanup 2021-01-16 18:50:34 -05:00
Jack Huey
7c3b6a63ad Use pred not binder 2021-01-16 18:40:47 -05:00
Jack Huey
f06eeaf982 Cleanup 2021-01-16 18:40:47 -05:00
Jack Huey
3436e21df5 Remove PredicateKind 2021-01-16 18:40:47 -05:00
Jack Huey
38e293cf5d Remove PredicateKind::Atom 2021-01-16 18:40:47 -05:00
flip1995
7449dc96c0 Deprecate unknown_clippy_lints
This is now handled by unknown_lints
2021-01-16 19:44:46 +01:00
Jason Newcomb
9146a77032
Update clippy_lints/src/redundant_slicing.rs
Co-authored-by: Philipp Krones <hello@philkrones.com>
2021-01-15 16:41:24 -05:00
Jason Newcomb
bf028b3f4a
fix copy-paste error 2021-01-15 16:41:22 -05:00
Jason Newcomb
27c0d6c14b
don't lint external macro expansions 2021-01-15 16:41:20 -05:00
Jason Newcomb
2a41d40807
fix new lint error 2021-01-15 16:41:17 -05:00
Jason Newcomb
837bc99065
Initial implementation of redundant_slicing lint 2021-01-15 16:41:13 -05:00
bors
3577cf79de Auto merge of #6500 - Javier-varez:case_sensitive_file_extensions, r=llogiq
Case sensitive file extensions

Closes #6425

Looks for ends_with methods calls with case sensitive extension comparisons.

changelog: Add new lint that warns about case-sensitive file extension comparisons.
2021-01-15 19:49:39 +00:00
ThibsG
46aa654c2d Fix test due to recent Rustup merge 2021-01-15 18:58:48 +01:00
ThibsG
83f1abff48 Fix FP with empty return for needless_return lint 2021-01-15 18:57:56 +01:00
bors
2d1e129851 Auto merge of #6574 - Jarcho:single_match_eq, r=Manishearth
single_match: suggest `if` over `if let` when possible

fixes: #173
changelog: single_match: suggest `if` over `if let` when possible
2021-01-15 16:25:03 +00:00
bors
9490fdca09 Auto merge of #6589 - giraffate:add_notes_of_prioritization_labels_to_doc, r=flip1995
Add notes of prioritization labels to doc

Refer to https://rust-lang.zulipchat.com/#narrow/stream/257328-clippy/topic/New.20prioritization.20labels.

changelog: none
2021-01-15 10:40:35 +00:00
Philipp Krones
8a77f63879
Fix formulations in label descriptions 2021-01-15 11:30:58 +01:00
bors
9ea66e946e Auto merge of #6555 - stanislav-tkach:patch-1, r=flip1995
Remove duplication in the manual_ok_or lint example

changelog: none
2021-01-15 10:27:47 +00:00
flip1995
488153ff2f Merge commit '953f024793dab92745fee9cd2c4dee6a60451771' into clippyup 2021-01-15 10:56:44 +01:00
bors
953f024793 Auto merge of #6586 - flip1995:rustup, r=flip1995
Rustup

r? `@ghost`

changelog: FP fix: [`needless_return`] no longer triggers inside macros.
2021-01-15 09:48:15 +00:00
flip1995
f18cf82ca8
Don't trigger needless_return lint in macros 2021-01-15 10:41:29 +01:00
flip1995
0c5ba9a883
Bump nightly version to 2021-01-15 2021-01-15 10:40:17 +01:00
flip1995
9bd037d0b5
Merge remote-tracking branch 'upstream/master' into rustup 2021-01-15 10:39:53 +01:00
Jason Newcomb
36ff2f739c
Rename function 2021-01-14 22:02:04 -05:00
Takayuki Nakata
d72cb252f2 Add notes of prioritization labels to doc 2021-01-15 09:17:43 +09:00
Jason Newcomb
85edd65bf6
Address review comments
Add: attempt to remove address of expressions from the scrutinee expression before adding references to the pattern
2021-01-14 14:26:26 -05:00
bors
7b3af4145b Auto merge of #79328 - c410-f3r:hir-if, r=matthewjasper
Reintroduce hir::ExprKind::If

Basically copied and paste #59288/https://github.com/rust-lang/rust-clippy/pull/4080 with some modifications.

The vast majority of tests were fixed and now there are only a few remaining. Since I am still unable to figure out the missing pieces, any help with the following list is welcome.

- [ ] **Unnecessary `typeck` exception**: [Cheated on this one to make CI green.](https://github.com/rust-lang/rust/pull/79328/files#diff-3faee9ba23fc54a12b7c43364ba81f8c5660045c7e1d7989a02a0cee1c5b2051)
- [x] **Incorrect span**: [Span should reference `then` and `else` separately.](https://github.com/rust-lang/rust/pull/79328/files#diff-cf2c46e82222ee4b1037a68fff8a1af3c4f1de7a6b3fd798aacbf3c0475abe3d)
- [x] **New note regarding `assert!`**: [Modified but not "wrong". Maybe can be a good thing?](https://github.com/rust-lang/rust/pull/79328/files#diff-9e0d7c89ed0224e2b62060c957177c27db43c30dfe3c2974cb6b5091cda9cfb5)
- [x] **Inverted report location**: [Modified but not "wrong". Locations were inverted.](https://github.com/rust-lang/rust/pull/79328/files#diff-f637ce7c1f68d523a165aa9651765df05e36c4d7d279194b1a6b28b48a323691)
- [x] **`src/test/ui/point-to-type-err-cause-on-impl-trait-return.rs` has weird errors**: [Not sure why this is happening.](https://github.com/rust-lang/rust/pull/79328/files#diff-c823c09660f5b112f95e97e8ff71f1797b6c7f37dbb3d16f8e98bbaea8072e95)
- [x] **Missing diagnostic**: [???](https://github.com/rust-lang/rust/pull/79328/files#diff-6b8ab09360d725ba4513933827f9796b42ff9522b0690f80b76de067143af2fc)
2021-01-14 14:41:58 +00:00
Daniel Smith
02f99bea87 Explicitly document false positives 2021-01-13 16:08:15 -05:00
bors
dcd8c8e739 Auto merge of #77524 - Patryk27:fixes/66228, r=estebank
Rework diagnostics for wrong number of generic args (fixes #66228 and #71924)

This PR reworks the `wrong number of {} arguments` message, so that it provides more details and contextual hints.
2021-01-13 20:35:58 +00:00
bors
00586dfdcd Auto merge of #6584 - giraffate:make_references_to_issues_links, r=llogiq
Make a reference a link in doc

I think it's incovenient that references in doc are just a text.

changelog: none
2021-01-13 08:16:43 +00:00
Joshua Nelson
dfb41f4797 Separate out a hir::Impl struct
This makes it possible to pass the `Impl` directly to functions, instead
of having to pass each of the many fields one at a time. It also
simplifies matches in many cases.
2021-01-12 20:32:33 -05:00
Takayuki Nakata
ea028497ed Make a reference a link in doc 2021-01-13 09:21:26 +09:00
rail
feee45c872 Fix the ICE 6539
It happened because `zero_sized_map_values` used `layout_of` with types
from type aliases, which is essentially the same as the ICE 4968.
2021-01-13 12:07:33 +13:00
Cameron Steffen
f2d493504c Similar names ignore underscore prefixed names 2021-01-12 14:21:28 -06:00
bors
13ca5c88f1 Auto merge of #6462 - flip1995:roadmap, r=flip1995,llogiq,killercup,Manishearth,oli-obk,matthiaskrgr,phansch,mikerite,mcarton,yaahc,ebroto
Roadmap for 2021

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

This is the first time Clippy gets its own roadmap. The reason for this roadmap is, that with the Rust language growing, also Clippy is growing. With this keeping track of and implementing bigger projects gets quite hard. This roadmap should help in exactly this regard.

After having the approval of this roadmap by the Clippy team, we want to know from the community:

- What do you think in general about this roadmap?
- Are there any pain points in Clippy, that should be included here?
- What of the points listed here has the highest priority for you?

We're looking forward to getting your feedback!

changelog: Add roadmap for Clippy 2021

r? `@rust-lang/clippy`
2021-01-12 16:33:47 +00:00
bors
7f4599a848 Auto merge of #6557 - rail-rain:extending_cast_ptr_alignment, r=phansch
Catch `pointer::cast` too in `cast_ptr_alignment`

Fixes #4708

Although there were some discussion in the issue, this PR implements the original feature. I think `cast_ptr_alignment` should exist as it is, separated from `ptr_as_ptr`.

---

changelog: Extend `cast_ptr_alignment` lint for the `pointer::cast` method
2021-01-11 22:03:46 +00:00
rail
53f87310cd Simplify cast_ptr_alignment pointer::casr case 2021-01-12 10:06:41 +13:00
bors
1eed27f374 Auto merge of #6575 - flip1995:stop_linting_deps, r=Manishearth
Change env var used for testing Clippy

This changes the variable used for testing Clippy in the internal test
suite:

```
CLIPPY_TESTS -> __CLIPPY_INTERNAL_TESTS
```

`CLIPPY_TESTS` is understandably used in environments of Clippy users,
so we shouldn't use it in our test suite.

changelog: Fix oversight which caused Clippy to lint deps in some environments.

Once again fixes https://github.com/rust-lang/rust-clippy/issues/3874
2021-01-11 16:49:32 +00:00
Jason Newcomb
8d7417d807
Add: single_match will suggest using if .. == .. instead of if let when applicable 2021-01-10 23:32:23 -05:00
Patryk Wychowaniec
2c6dc8801f Rework diagnostics for wrong number of generic args 2021-01-10 13:07:40 +01:00