]> git.lizzy.rs Git - rust.git/log
rust.git
3 years agoAuto merge of #6630 - xFrednet:0000-configuration-documentation, r=llogiq
bors [Mon, 25 Jan 2021 00:25:31 +0000 (00:25 +0000)]
Auto merge of #6630 - xFrednet:0000-configuration-documentation, r=llogiq

Documentation for adding configuration to a lint and common abbreviations

This PR adds some commonly used abbreviations to the `basis.md` file and a guide on how to implement a configuration value for a lint.

* [Rendered `/doc/basics.md` (Abbreviation list)](https://github.com/xFrednet/rust-clippy/blob/0000-configuration-documentation/doc/basics.md#common-abbreviations)
* [Rendered `/doc/adding_lints.md` (Configuration value guide)](https://github.com/xFrednet/rust-clippy/blob/0000-configuration-documentation/doc/adding_lints.md#adding-configuration-to-a-lint)

I'm not sure if the guide is written in the best way. Style suggestions are appreciated. :upside_down_face:

 ---

Again a big **thank you** for everyone who helped to collect the abbreviation list over on [zulip]. I had a lot of fun, and it was also very informative. Keep up the good work :upside_down_face:

[zulip]: https://rust-lang.zulipchat.com/#narrow/stream/257328-clippy/topic/Common.20abbreviations.20in.20basics.2Emd/near/223548065
---

changelog: none

3 years agoAdded documentation for adding a configuration to lints
xFrednet [Fri, 22 Jan 2021 18:04:28 +0000 (19:04 +0100)]
Added documentation for adding a configuration to lints

* Fixed some spelling

3 years agoAuto merge of #6403 - camsteffen:similar-names-underscore, r=Manishearth
bors [Fri, 22 Jan 2021 23:44:12 +0000 (23:44 +0000)]
Auto merge of #6403 - camsteffen:similar-names-underscore, r=Manishearth

Similar names ignore underscore prefixed names

changelog: Ignore underscore-prefixed names for similar_names

IMO, this lint is not very helpful for underscore-prefixed variables. Usually they are unused or are just there to ignore part of a destructuring.

3 years agoAuto merge of #6619 - camsteffen:collapsible-match, r=camsteffen
bors [Fri, 22 Jan 2021 22:45:43 +0000 (22:45 +0000)]
Auto merge of #6619 - camsteffen:collapsible-match, r=camsteffen

Improve collapsible_match

changelog: Fix collapsible_match false negatives

Allow `&` and/or `*` on the binding and make sure the type still matches.

3 years agoFix dogfood
Cameron Steffen [Fri, 22 Jan 2021 01:25:22 +0000 (19:25 -0600)]
Fix dogfood

3 years agoEnhance collapsible_match for adjusted bindings
Cameron Steffen [Fri, 22 Jan 2021 01:21:12 +0000 (19:21 -0600)]
Enhance collapsible_match for adjusted bindings

3 years agoAuto merge of #6591 - camsteffen:manual-filter-map, r=llogiq
bors [Fri, 22 Jan 2021 22:28:41 +0000 (22:28 +0000)]
Auto merge of #6591 - camsteffen:manual-filter-map, r=llogiq

`manual_filter_map` and `manual_find_map`

changelog: Add `manual_filter_map` and replace `find_map` with `manual_find_map`

Replaces #6453

Fixes #3188
Fixes #4193

~Depends on #6567 (to fix an internal lint false positive)~

This replaces `filter_map` and `find_map` with `manual_filter_map` and `manual_find_map` respectively. However, `filter_map` is left in place since it is used for a variety of other cases. See discussion in #6453.

3 years agoAuto merge of #6621 - giraffate:improve_the_example_in_ref_in_deref, r=flip1995
bors [Fri, 22 Jan 2021 14:04:31 +0000 (14:04 +0000)]
Auto merge of #6621 - giraffate:improve_the_example_in_ref_in_deref, r=flip1995

Improve the example in `ref_in_deref`

Add a suggested code to the example in doc

changelog: none

3 years agoImprove the example in `ref_in_deref`
Takayuki Nakata [Fri, 22 Jan 2021 13:51:06 +0000 (22:51 +0900)]
Improve the example in `ref_in_deref`

3 years agoDeprecate find_map lint
Cameron Steffen [Thu, 14 Jan 2021 22:47:22 +0000 (16:47 -0600)]
Deprecate find_map lint

3 years agoRemove unneeded allow's
Cameron Steffen [Mon, 14 Dec 2020 20:03:11 +0000 (14:03 -0600)]
Remove unneeded allow's

3 years agoReplace find_map with manual_find_map
Cameron Steffen [Thu, 14 Jan 2021 22:36:36 +0000 (16:36 -0600)]
Replace find_map with manual_find_map

3 years agoSplit filter_map into manual_filter_map
Cameron Steffen [Fri, 1 Jan 2021 19:00:09 +0000 (13:00 -0600)]
Split filter_map into manual_filter_map

3 years agoAdd expr_fallback to SpanlessEq
Cameron Steffen [Fri, 1 Jan 2021 19:00:44 +0000 (13:00 -0600)]
Add expr_fallback to SpanlessEq

3 years agoFix comment
Cameron Steffen [Mon, 14 Dec 2020 19:50:53 +0000 (13:50 -0600)]
Fix comment

3 years agoCheck if let guard in collapsible_match
Cameron Steffen [Fri, 22 Jan 2021 00:12:46 +0000 (18:12 -0600)]
Check if let guard in collapsible_match

3 years agoAdded documentation for common abbreviations
xFrednet [Thu, 21 Jan 2021 23:19:22 +0000 (00:19 +0100)]
Added documentation for common abbreviations

This list was created as a collaborative effort on Zulip and the [thread] is definitely worth a read as we had quite some fun. A big **THANK YOU** goes out to everyone who participated you make this project fun to work on!!!

The Zulip [thread]: https://rust-lang.zulipchat.com/#narrow/stream/257328-clippy/topic/Common.20abbreviations.20in.20basics.2Emd/near/223548065

3 years agoAuto merge of #6609 - giraffate:fix_wrong_suggestion_of_ref_in_deref, r=llogiq
bors [Thu, 21 Jan 2021 19:16:11 +0000 (19:16 +0000)]
Auto merge of #6609 - giraffate:fix_wrong_suggestion_of_ref_in_deref, r=llogiq

Fix a wrong suggestion of `ref_in_deref`

Fix #6358.

changelog: Fix a wrong suggestion of `ref_in_deref`

3 years agoAuto merge of #6605 - kawogi:doc-markdown, r=llogiq
bors [Thu, 21 Jan 2021 19:05:50 +0000 (19:05 +0000)]
Auto merge of #6605 - kawogi:doc-markdown, r=llogiq

Doc markdown

I added "WebGL" along the lines of the existing "OpenGL" to the whitelist of `doc_markdown` as I found this to be a pretty common term.

(this is a follow-up of the now closed https://github.com/rust-lang/rust-clippy/pull/6388)

changelog: Whitelist "WebGL" in `doc_markdown`.

3 years agoAuto merge of #6532 - matthiaskrgr:mlmm, r=llogiq
bors [Thu, 21 Jan 2021 18:34:55 +0000 (18:34 +0000)]
Auto merge of #6532 - matthiaskrgr:mlmm, r=llogiq

match_like_matches_macro: strip refs in suggestion

fixes #6503

changelog: match_like_matches_macro: strip refs in suggestion (#6503)

3 years agoAuto merge of #6408 - pro-grammer1:master, r=oli-obk
bors [Thu, 21 Jan 2021 14:23:25 +0000 (14:23 +0000)]
Auto merge of #6408 - pro-grammer1:master, r=oli-obk

Fix false positive in write_literal and print_literal (numeric literals)

changelog: No longer lint numeric literals in [`write_literal`] and [`print_literal`].

Fixes #6335

3 years agoAuto merge of #6611 - pastchick3:master, r=flip1995
bors [Thu, 21 Jan 2021 14:12:43 +0000 (14:12 +0000)]
Auto merge of #6611 - pastchick3:master, r=flip1995

Fix the reversed suggestion message of `stable_sort_primitive`.

Now Clippy emits `stable_sort_primitive` warning as follows:

```
warning: used sort instead of sort_unstable to sort primitive type `usize`
  --> src\asm.rs:41:13
   |
41 |             self.successors.sort();
   |             ^^^^^^^^^^^^^^^^^^^^^^ help: try: `self.successors.sort_unstable()`
   |
   = note: `#[warn(clippy::stable_sort_primitive)]` on by default
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#stable_sort_primitive
```

I think the position of `sort` and `sort_unstable` in the first line should be reversed.

changelog: Fix the reversed suggestion message of `stable_sort_primitive`.

3 years agoImprove the suggestion message of `stable_sort_primitive`.
pastchick3 [Wed, 20 Jan 2021 12:05:25 +0000 (20:05 +0800)]
Improve the suggestion message of `stable_sort_primitive`.

3 years agoAuto merge of #6567 - camsteffen:path-to-res-enum, r=Manishearth
bors [Wed, 20 Jan 2021 21:35:11 +0000 (21:35 +0000)]
Auto merge of #6567 - camsteffen:path-to-res-enum, r=Manishearth

Fix path_to_res for enum inherent items

changelog: none

I tried to add `Option::is_some` to the paths but got a false positive from the invalid paths lint. Turns out the `path_to_res` function does not find inherent impls for enums. I fixed this and took the liberty to do some additional cleanup in the method.

3 years agoAuto merge of #6475 - matsujika:capitalized_acronyms, r=flip1995
bors [Wed, 20 Jan 2021 10:26:01 +0000 (10:26 +0000)]
Auto merge of #6475 - matsujika:capitalized_acronyms, r=flip1995

Add new lint `upper_case_acronyms`

Close #1335
I need some reviews on the English sentences because I feel they're messed up. ;)

changelog: Add new lint `upper_case_acronyms`

3 years agoRemove nightly-gate of `split_inclusive`
Hirochika Matsumoto [Wed, 20 Jan 2021 09:14:09 +0000 (18:14 +0900)]
Remove nightly-gate of `split_inclusive`

Co-authored-by: Philipp Krones <hello@philkrones.com>
3 years agoAdd new lint `upper_case_acronyms`
Hirochika Matsumoto [Sat, 19 Dec 2020 13:50:45 +0000 (22:50 +0900)]
Add new lint `upper_case_acronyms`

3 years agoRun `cargo dev new_lint`
Hirochika Matsumoto [Sat, 19 Dec 2020 09:57:11 +0000 (18:57 +0900)]
Run `cargo dev new_lint`

3 years agoAuto merge of #6578 - MarijnS95:size-in-element-count-divide-by-byte-size, r=flip1995
bors [Wed, 20 Jan 2021 07:24:34 +0000 (07:24 +0000)]
Auto merge of #6578 - MarijnS95:size-in-element-count-divide-by-byte-size, r=flip1995

size_of_in_element_count: Disable lint on division by byte-size

Fixes #6511

It is fairly common to divide some length in bytes by the byte-size of a single element before creating a `from_raw_parts` slice or similar operation. This lint would erroneously disallow such expressions.

Just in case, instead of simply disabling this lint in the RHS of a division, keep track of the inversion and enable it again on recursive division.

---

changelog: Do not trigger size_of_in_element_count when dividing by element size

3 years agosize_of_in_element_count: Disable lint on division by byte-size
Marijn Suijten [Tue, 12 Jan 2021 10:35:44 +0000 (11:35 +0100)]
size_of_in_element_count: Disable lint on division by byte-size

It is fairly common to divide some length in bytes by the byte-size of a
single element before creating a `from_raw_parts` slice or similar
operation. This lint would erroneously disallow such expressions.

Just in case, instead of simply disabling this lint in the RHS of a
division, keep track of the inversion and enable it again on recursive
division.

3 years agosize_of_in_element_count: Separate test file in expressions and functions
Marijn Suijten [Tue, 19 Jan 2021 18:20:26 +0000 (19:20 +0100)]
size_of_in_element_count: Separate test file in expressions and functions

An upcoming test case for new expresssion variants make the stderr file
go over 200 lines. Split this test case in two to have a clear
distinction between checking whether the lint is still applying on
all the functions with member counts as argument, versus validating
various member-count expressions that may or may not be invalid.

3 years agoFix a wrong suggestion of `ref_in_deref`
Takayuki Nakata [Tue, 19 Jan 2021 14:51:10 +0000 (23:51 +0900)]
Fix a wrong suggestion of `ref_in_deref`

3 years agoAuto merge of #6577 - nahuakang:inspect_then_for_each, r=flip1995
bors [Tue, 19 Jan 2021 13:12:39 +0000 (13:12 +0000)]
Auto merge of #6577 - nahuakang:inspect_then_for_each, r=flip1995

New Lint: inspect_then_for_each

**Work In Progress**

This PR addresses [Issue 5209](https://github.com/rust-lang/rust-clippy/issues/5209) and adds a new lint called `inspect_then_for_each`.

Current seek some guidance.

If you added a new lint, here's a checklist for things that will be
checked during review or continuous integration.

- \[x] Followed [lint naming conventions][lint_naming]
- \[x] Added passing UI tests (including committed `.stderr` file)
- \[x] `cargo test` passes locally
- \[x] Executed `cargo dev update_lints`
- \[x] Added lint documentation
- \[x] Run `cargo dev fmt`

[lint_naming]: https://rust-lang.github.io/rfcs/0344-conventions-galore.html#lints

---

changelog: Add [`inspect_for_each`] lint for the use of `inspect().for_each()` on `Iterators`.

3 years agoCreate new lint for the usage of inspect for each.
nahuakang [Mon, 11 Jan 2021 22:56:12 +0000 (23:56 +0100)]
Create new lint for the usage of inspect for each.

3 years agoAuto merge of #6608 - rail-rain:note_on_as_conversions, r=phansch
bors [Tue, 19 Jan 2021 08:01:56 +0000 (08:01 +0000)]
Auto merge of #6608 - rail-rain:note_on_as_conversions, r=phansch

Add a note to `as_conversions`

I have seen a couple of examples where there are some misunderstandings of `as_conversions` ([1](https://github.com/rust-lang/rust-clippy/issues/5890#issuecomment-671852546), [2](https://github.com/rust-lang/rust-clippy/issues/6116#issuecomment-704251710) and [3](https://github.com/rust-lang/rust-clippy/issues/6428)). This PR adds the note that explains its purpose and relationship with other `as` related casts. Open question: should I list every related lints for discoverbility, or just suggest how to find these? I chose the former because there's no way to list only and all `as` related lints (e.g. on All the Clippt Lints, 'cast' includes some noises, but `cast_` excludes some) even though I cannot guarantee the list will be updated to include future changes.

---

changelog: Add a note to the document of `as_conversions`

3 years agoAuto merge of #6606 - ThibsG:AddTestNeedlessReturn, r=flip1995
bors [Tue, 19 Jan 2021 07:30:55 +0000 (07:30 +0000)]
Auto merge of #6606 - ThibsG:AddTestNeedlessReturn, r=flip1995

Add test for `needless_return` lint

Just a follow up of #6549 that adds a test for this lint.

changelog: none

3 years agoAdd a note to `as_conversions`
rail [Mon, 18 Jan 2021 23:46:24 +0000 (12:46 +1300)]
Add a note to `as_conversions`

… to clalify its purpose.

3 years agoAdd test for `needless_return` lint
ThibsG [Mon, 18 Jan 2021 21:33:25 +0000 (22:33 +0100)]
Add test for `needless_return` lint

3 years agoadd test for doc_valid_idents "WebGL"
kai.giebeler [Sun, 17 Jan 2021 21:57:08 +0000 (22:57 +0100)]
add test for doc_valid_idents "WebGL"

3 years agoMerge remote-tracking branch 'upstream/master' into doc-markdown
kai.giebeler [Sun, 17 Jan 2021 21:25:56 +0000 (22:25 +0100)]
Merge remote-tracking branch 'upstream/master' into doc-markdown

3 years agoAdd numeric literals to the write_literal and print_literal tests that shouldn't...
pro-grammer1 [Sun, 17 Jan 2021 19:21:33 +0000 (19:21 +0000)]
Add numeric literals to the write_literal and print_literal tests that shouldn't fail

3 years agoRemove numeric literals from print_literal and write_literal tests
pro-grammer1 [Sun, 17 Jan 2021 18:55:59 +0000 (18:55 +0000)]
Remove numeric literals from print_literal and write_literal tests

3 years agoNegate results of matches!
pro-grammer1 [Sun, 17 Jan 2021 18:21:58 +0000 (18:21 +0000)]
Negate results of matches!

3 years agoReplace another instance of match with matches
pro-grammer1 [Sun, 17 Jan 2021 18:01:01 +0000 (18:01 +0000)]
Replace another instance of match with matches

3 years agoAuto merge of #6585 - Daniel-B-Smith:false-positive-issue, r=flip1995
bors [Sun, 17 Jan 2021 17:14:13 +0000 (17:14 +0000)]
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

3 years agoAuto merge of #6528 - Jarcho:redundant_slicing, r=flip1995
bors [Sun, 17 Jan 2021 16:26:28 +0000 (16:26 +0000)]
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.

3 years agoAuto merge of #6582 - rail-rain:ice_6539, r=flip1995
bors [Sun, 17 Jan 2021 15:38:50 +0000 (15:38 +0000)]
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`

3 years agoAuto merge of #6549 - ThibsG:FixClosureNeedlessReturn, r=phansch
bors [Sun, 17 Jan 2021 10:29:10 +0000 (10:29 +0000)]
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

3 years agoRun tests/ui/update-all-references.sh and refactor match into matches!
pro-grammer1 [Sun, 17 Jan 2021 08:48:37 +0000 (08:48 +0000)]
Run tests/ui/update-all-references.sh and refactor match into matches!

3 years agoUpdate clippy_lints/src/redundant_slicing.rs
Jason Newcomb [Thu, 14 Jan 2021 21:38:57 +0000 (21:38 +0000)]
Update clippy_lints/src/redundant_slicing.rs

Co-authored-by: Philipp Krones <hello@philkrones.com>
3 years agofix copy-paste error
Jason Newcomb [Thu, 31 Dec 2020 19:40:07 +0000 (14:40 -0500)]
fix copy-paste error

3 years agodon't lint external macro expansions
Jason Newcomb [Thu, 31 Dec 2020 17:07:24 +0000 (12:07 -0500)]
don't lint external macro expansions

3 years agofix new lint error
Jason Newcomb [Thu, 31 Dec 2020 16:42:12 +0000 (11:42 -0500)]
fix new lint error

3 years agoInitial implementation of redundant_slicing lint
Jason Newcomb [Thu, 31 Dec 2020 16:10:13 +0000 (11:10 -0500)]
Initial implementation of redundant_slicing lint

3 years agoAuto merge of #6500 - Javier-varez:case_sensitive_file_extensions, r=llogiq
bors [Fri, 15 Jan 2021 19:49:39 +0000 (19:49 +0000)]
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.

3 years agoFix test due to recent Rustup merge
ThibsG [Fri, 15 Jan 2021 17:58:48 +0000 (18:58 +0100)]
Fix test due to recent Rustup merge

3 years agoFix FP with empty return for `needless_return` lint
ThibsG [Mon, 4 Jan 2021 20:20:44 +0000 (21:20 +0100)]
Fix FP with empty return for `needless_return` lint

3 years agoAuto merge of #6574 - Jarcho:single_match_eq, r=Manishearth
bors [Fri, 15 Jan 2021 16:25:03 +0000 (16:25 +0000)]
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

3 years agoAuto merge of #6589 - giraffate:add_notes_of_prioritization_labels_to_doc, r=flip1995
bors [Fri, 15 Jan 2021 10:40:35 +0000 (10:40 +0000)]
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

3 years agoFix formulations in label descriptions
Philipp Krones [Fri, 15 Jan 2021 10:30:58 +0000 (11:30 +0100)]
Fix formulations in label descriptions

3 years agoAuto merge of #6555 - stanislav-tkach:patch-1, r=flip1995
bors [Fri, 15 Jan 2021 10:27:47 +0000 (10:27 +0000)]
Auto merge of #6555 - stanislav-tkach:patch-1, r=flip1995

Remove duplication in the manual_ok_or lint example

changelog: none

3 years agoAuto merge of #6586 - flip1995:rustup, r=flip1995
bors [Fri, 15 Jan 2021 09:48:15 +0000 (09:48 +0000)]
Auto merge of #6586 - flip1995:rustup, r=flip1995

Rustup

r? `@ghost`

changelog: FP fix: [`needless_return`] no longer triggers inside macros.

3 years agoDon't trigger needless_return lint in macros
flip1995 [Fri, 15 Jan 2021 09:41:29 +0000 (10:41 +0100)]
Don't trigger needless_return lint in macros

3 years agoBump nightly version to 2021-01-15
flip1995 [Fri, 15 Jan 2021 09:40:17 +0000 (10:40 +0100)]
Bump nightly version to 2021-01-15

3 years agoMerge remote-tracking branch 'upstream/master' into rustup
flip1995 [Fri, 15 Jan 2021 09:02:28 +0000 (10:02 +0100)]
Merge remote-tracking branch 'upstream/master' into rustup

3 years agoRename function
Jason Newcomb [Fri, 15 Jan 2021 03:02:04 +0000 (22:02 -0500)]
Rename function

3 years agoAdd notes of prioritization labels to doc
Takayuki Nakata [Fri, 15 Jan 2021 00:11:31 +0000 (09:11 +0900)]
Add notes of prioritization labels to doc

3 years agoAddress review comments
Jason Newcomb [Thu, 14 Jan 2021 19:26:26 +0000 (14:26 -0500)]
Address review comments

Add: attempt to remove address of expressions from the scrutinee expression before adding references to the pattern

3 years agoAuto merge of #79328 - c410-f3r:hir-if, r=matthewjasper
bors [Thu, 14 Jan 2021 14:41:58 +0000 (14:41 +0000)]
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)

3 years agoExplicitly document false positives
Daniel Smith [Wed, 13 Jan 2021 21:08:15 +0000 (16:08 -0500)]
Explicitly document false positives

3 years agoAuto merge of #77524 - Patryk27:fixes/66228, r=estebank
bors [Wed, 13 Jan 2021 20:35:58 +0000 (20:35 +0000)]
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.

3 years agoAuto merge of #6584 - giraffate:make_references_to_issues_links, r=llogiq
bors [Wed, 13 Jan 2021 08:16:43 +0000 (08:16 +0000)]
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

3 years agoSeparate out a `hir::Impl` struct
Joshua Nelson [Sun, 22 Nov 2020 22:46:21 +0000 (17:46 -0500)]
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.

3 years agoMake a reference a link in doc
Takayuki Nakata [Wed, 13 Jan 2021 00:21:26 +0000 (09:21 +0900)]
Make a reference a link in doc

3 years agoFix the ICE 6539
rail [Tue, 12 Jan 2021 22:08:12 +0000 (11:08 +1300)]
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.

3 years agoSimilar names ignore underscore prefixed names
Cameron Steffen [Sat, 28 Nov 2020 22:56:59 +0000 (16:56 -0600)]
Similar names ignore underscore prefixed names

3 years agoAuto merge of #6462 - flip1995:roadmap, r=flip1995,llogiq,killercup,Manishearth,oli...
bors [Tue, 12 Jan 2021 16:33:47 +0000 (16:33 +0000)]
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`

3 years agoAuto merge of #6557 - rail-rain:extending_cast_ptr_alignment, r=phansch
bors [Mon, 11 Jan 2021 22:03:46 +0000 (22:03 +0000)]
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

3 years agoSimplify `cast_ptr_alignment` `pointer::casr` case
rail [Mon, 11 Jan 2021 21:06:41 +0000 (10:06 +1300)]
Simplify `cast_ptr_alignment` `pointer::casr` case

3 years agoAuto merge of #6575 - flip1995:stop_linting_deps, r=Manishearth
bors [Mon, 11 Jan 2021 16:49:32 +0000 (16:49 +0000)]
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

3 years agoAdd: single_match will suggest using if .. == .. instead of if let when applicable
Jason Newcomb [Mon, 11 Jan 2021 04:32:23 +0000 (23:32 -0500)]
Add: single_match will suggest using if .. == .. instead of if let when applicable

3 years agoRework diagnostics for wrong number of generic args
Patryk Wychowaniec [Sat, 2 Jan 2021 18:45:11 +0000 (19:45 +0100)]
Rework diagnostics for wrong number of generic args

3 years agoast: Remove some indirection layers from values in key-value attributes
Vadim Petrochenkov [Sat, 19 Dec 2020 20:38:22 +0000 (23:38 +0300)]
ast: Remove some indirection layers from values in key-value attributes

3 years agoAuto merge of #6565 - giraffate:small_fixes_of_doc_in_needless_question_mark, r=phansch
bors [Sat, 9 Jan 2021 15:28:10 +0000 (15:28 +0000)]
Auto merge of #6565 - giraffate:small_fixes_of_doc_in_needless_question_mark, r=phansch

Small fixes of doc in `needless_question_mark`

changelog: none

3 years agoAuto merge of #6571 - ThibsG:BoxedLocalTrait, r=phansch
bors [Sat, 9 Jan 2021 13:42:28 +0000 (13:42 +0000)]
Auto merge of #6571 - ThibsG:BoxedLocalTrait, r=phansch

Fix FP for `boxed_local` lint in default trait fn impl

Fix FP on default trait function implementation on `boxed_local` lint.

Maybe I checked too much when looking if `self` is carrying `Self` in its bound type.
I can't find a good test case for this, so it could be too much conservative.
Let me know if you think only detecting `self` parameter is enough.

Fixes: #4804
changelog: none

3 years agoFix FP for `boxed_local` lint in default trait fn impl
ThibsG [Sat, 9 Jan 2021 11:26:24 +0000 (12:26 +0100)]
Fix FP for `boxed_local` lint in default trait fn impl

3 years agoAuto merge of #6569 - camsteffen:symbol-comparison, r=Manishearth
bors [Fri, 8 Jan 2021 23:25:57 +0000 (23:25 +0000)]
Auto merge of #6569 - camsteffen:symbol-comparison, r=Manishearth

Internal lint symbol comparisons

changelog: none

* Added awareness of `rustc_span::symbol::kw::*` symbols.
* Compare with const symbols: `symbol.as_str() == "self"` => `symbol == kw::SelfLower`
* Don't compare symbols by string: `a.as_str() == b.as_str()` => `a == b`
* Lint comparing with `to_ident_string` or `to_string` instead of `Symbol::as_str`.

3 years agoFix symbol string comparison dogfood
Cameron Steffen [Tue, 29 Dec 2020 22:04:31 +0000 (16:04 -0600)]
Fix symbol string comparison dogfood

3 years agoAdd unnecessary symbol string lint
Cameron Steffen [Wed, 30 Dec 2020 21:52:15 +0000 (15:52 -0600)]
Add unnecessary symbol string lint

3 years agoFix unnecessary keyword intern dogfood
Cameron Steffen [Tue, 29 Dec 2020 21:43:18 +0000 (15:43 -0600)]
Fix unnecessary keyword intern dogfood

3 years agoAdd keywords to interning defined symbol lint
Cameron Steffen [Tue, 29 Dec 2020 21:40:55 +0000 (15:40 -0600)]
Add keywords to interning defined symbol lint

3 years agoUse DefId in interning defined symbol lint
Cameron Steffen [Wed, 30 Dec 2020 21:38:21 +0000 (15:38 -0600)]
Use DefId in interning defined symbol lint

3 years agoFix path_to_res for enum inherent items
Cameron Steffen [Wed, 6 Jan 2021 21:14:01 +0000 (15:14 -0600)]
Fix path_to_res for enum inherent items

3 years agoAuto merge of #6566 - giraffate:reduce_the_span_in_from_over_into, r=Manishearth
bors [Fri, 8 Jan 2021 01:49:26 +0000 (01:49 +0000)]
Auto merge of #6566 - giraffate:reduce_the_span_in_from_over_into, r=Manishearth

Reduce the span in `from_over_into` to impl header

A follow up of https://github.com/rust-lang/rust-clippy/pull/6476#discussion_r546271382
> That item might be quite large. We may want to reduce the span to the `impl` header.

changelog: none

3 years agoMove `is_hir_ty_cfg_dependant` to `util`,
rail [Fri, 8 Jan 2021 01:15:12 +0000 (14:15 +1300)]
Move `is_hir_ty_cfg_dependant` to `util`,

add stuff on pointer::cast` to the document for `cast_ptr_alignment`
and fix line numbers in the test.

3 years agoReduce the span in `from_over_into` to impl header
Takayuki Nakata [Thu, 7 Jan 2021 23:37:57 +0000 (08:37 +0900)]
Reduce the span in `from_over_into` to impl header

3 years agoSmall fixes of doc in `needless_question_mark`
Takayuki Nakata [Thu, 7 Jan 2021 23:45:15 +0000 (08:45 +0900)]
Small fixes of doc in `needless_question_mark`

3 years agoReintroduce hir::ExprKind::If
Caio [Fri, 1 Jan 2021 18:38:11 +0000 (15:38 -0300)]
Reintroduce hir::ExprKind::If

3 years agoAuto merge of #6558 - stanislav-tkach:patch-2, r=flip1995
bors [Thu, 7 Jan 2021 13:38:32 +0000 (13:38 +0000)]
Auto merge of #6558 - stanislav-tkach:patch-2, r=flip1995

Fix typo: `irrevelent` -> `irrelevant`

changelog: none

3 years agoFix typo: `irrevelent` -> `irrelevant`
Stanislav Tkach [Thu, 7 Jan 2021 11:59:55 +0000 (13:59 +0200)]
Fix typo: `irrevelent` -> `irrelevant`