Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Clippy #81038

Merged
merged 77 commits into from
Jan 18, 2021
Merged

Update Clippy #81038

merged 77 commits into from
Jan 18, 2021

Conversation

flip1995
Copy link
Member

Biweekly Clippy update

r? @Manishearth

flip1995 and others added 30 commits December 17, 2020 21:44
The core issue was the usage of `reference_file_path.file_name()`, which
provided a non-existent path if the file to be updated was in a
subdirectory.

Instead we have to provide the whole path after 'tests/ui/' as the
'filename'. This part of the path is called `test_name` in the code now.
This should make the code slightly more understandable
fixes rust-lang#6522

changelog: field_reassign_with_default: don't expand macros in lint suggestion (rust-lang#6522)
Update CHANGELOG for Rust 1.50

changelog: none

r? `@flip1995`
field_reassign_with_default: don't expand macros in suggestion

fixes rust-lang#6522

changelog: field_reassign_with_default: don't expand macros in lint suggestion (rust-lang#6522)
Ensure `Copy` exception in trait definition for `wrong_self_conventio…

Add a test case to ensure `Copy` exception is preserved also in trait definition, when passing `self` by value.

Follow up of rust-lang#6316

changelog: none
Fix blessing of test output in subdirectories

The core issue was the usage of `reference_file_path.file_name()`, which
provided a non-existent path if the file to be updated was in a
subdirectory.

Instead we have to provide the whole path after 'tests/ui/' as the
'filename'. This part of the path is called `test_name` in the code now.

changelog: none
… enable/disable it particularly

This splits up clippy::collapsible_if into collapsible_if for
if x {
  if y { }
}
=>
if x && y { }

and collapsible_else_if for

if x {
} else {
 if y { }
}

=>
if x {

} else if y {

}

so that we can lint for only the latter but not the first if we desire.

changelog: collapsible_if: split up linting for if x {} else { if y {} } into collapsible_else_if lint
collapsible_if: split collapsible_else_if into its own lint so we can enable/disable it particularly

This splits up clippy::collapsible_if into collapsible_if for
if x {
  if y { }
}
=>
if x && y { }

and collapsible_else_if for

if x {
} else {
 if y { }
}

=>
if x {

} else if y {

}

so that we can lint for only the latter but not the first if we desire.

changelog: collapsible_if: split up linting for if x {} else { if y {} } into collapsible_else_if lint
Needless Question Mark Lint

Fixes rust-lang#6410, i.e the needless question mark lint

changelog: [`needless_question_mark`] New lint
Add ui-internal to cargo dev bless

changelog: internal
bors and others added 14 commits January 11, 2021 16:49
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 rust-lang/rust-clippy#3874
…, r=phansch

Catch `pointer::cast` too in `cast_ptr_alignment`

Fixes rust-lang#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
…llercup,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`
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.
…nks, r=llogiq

Make a reference a link in doc

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

changelog: none
Rework diagnostics for wrong number of generic args (fixes rust-lang#66228 and rust-lang#71924)

This PR reworks the `wrong number of {} arguments` message, so that it provides more details and contextual hints.
Reintroduce hir::ExprKind::If

Basically copied and paste rust-lang#59288/rust-lang/rust-clippy#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)
Rustup

r? `@ghost`

changelog: FP fix: [`needless_return`] no longer triggers inside macros.
@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jan 15, 2021
@Manishearth
Copy link
Member

@bors r+

@bors
Copy link
Contributor

bors commented Jan 15, 2021

📌 Commit 3e236b3 has been approved by Manishearth

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jan 15, 2021
m-ou-se added a commit to m-ou-se/rust that referenced this pull request Jan 16, 2021
Update Clippy

Biweekly Clippy update

r? `@Manishearth`
@flip1995

This comment has been minimized.

bors added a commit to rust-lang-ci/rust that referenced this pull request Jan 18, 2021
Rollup of 12 pull requests

Successful merges:

 - rust-lang#81038 (Update Clippy)
 - rust-lang#81071 (rustc_parse_format: Fix character indices in find_skips)
 - rust-lang#81100 (prevent potential bug in `encode_with_shorthand`.)
 - rust-lang#81105 (Initialize a few variables directly)
 - rust-lang#81116 (ConstProp: Copy body span instead of querying it)
 - rust-lang#81121 (Avoid logging the whole MIR body in SimplifyCfg)
 - rust-lang#81123 (Update cmp.rs)
 - rust-lang#81125 (Add track_caller to .steal())
 - rust-lang#81128 (validation test: turn some const_err back into validation failures)
 - rust-lang#81131 (Edit rustc_middle::ty::cast docs)
 - rust-lang#81142 (Replace let Some(..) = with .is_some())
 - rust-lang#81153 (Remove unused linkcheck exceptions)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 090ab8c into rust-lang:master Jan 18, 2021
@rustbot rustbot added this to the 1.51.0 milestone Jan 18, 2021
@flip1995 flip1995 deleted the clippyup branch January 18, 2021 17:32
flip1995 pushed a commit to flip1995/rust that referenced this pull request Jan 30, 2021
Update Clippy

Biweekly Clippy update

r? ``@Manishearth``
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet