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 #78774

Merged
merged 107 commits into from
Nov 5, 2020
Merged

Update Clippy #78774

merged 107 commits into from
Nov 5, 2020

Conversation

flip1995
Copy link
Member

@flip1995 flip1995 commented Nov 5, 2020

Biweekly Clippy update

r? @Manishearth

achris and others added 30 commits October 14, 2020 23:49
The items_after_statements lint was skipping all expansions.  Instead
we should still lint local macros.

Fixes rust-lang#578
Co-authored-by: Philipp Krones <hello@philkrones.com>
Co-authored-by: Philipp Krones <hello@philkrones.com>
Co-authored-by: Philipp Krones <hello@philkrones.com>
Co-authored-by: Philipp Krones <hello@philkrones.com>
fix the error-causing suggestion of 'borrowed_box',
which missed parentheses and was ambiguous.
pitiK3U and others added 18 commits November 3, 2020 16:44
…r=flip1995

Add lint: from_iter_instead_of_collect

Fixes rust-lang#5679

This implements lint for `::from_iter()` from rust-lang#5679 not the general issue (`std::ops::Add::add`, etc.).
This lint checks if expression is function call with `from_iter` name and if it's implementation of the `std::iter::FromIterator` trait.

changelog: Introduce  from_iter_instead_of_collect lint
Add lint 'ref_option_ref' rust-lang#1377

This lint checks for usage of `&Option<&T>` which can be simplified as `Option<&T>` as suggested in rust-lang#1377.

This WIP PR is here to get feedback on the lint as there's more cases to be handled:
* statics/consts,
* associated types,
* type alias,
* function/method parameter/return,
* ADT definitions (struct/tuple struct fields, enum variants)

changelog: Add 'ref_option_ref' lint
add manual_ok_or lint

Implements partially rust-lang#5923

changelog: add lint manual_ok_or
…e_disable, r=flip1995

Clarify allow/warn/deny documentation.  Remove enable/disable.

Disable and enable when not specifically explained were not clear to me
as an English language speaker, but I was able to figure it out fairly
easily due to the examples having A/W, which I assumed meant `allow` and
`warn`.  I removed both words to be sure it was clear as well as
extending the note on what deny means.  It now includes a statement on
exactly what each word means.

Documentation only update.

*Please keep the line below*
changelog: none
Use const sym where possible

I ran a regex search and replace to use const `sym` values where possible. This should give some performance boost by avoiding string interning at runtime.

Con: It is not as consistent as always using `sym!`.

I also changed an internal lint to suggest using `sym::{}`, making an assumption that this will always work for diagnostic items.

changelog: none
Rustup

changelog: none

r? `@ghost`
Add lint for 'field_reassign_with_default` rust-lang#568

changelog: Add lint for field_reassign_with_default that checks if mutable object + field modification is used to edit a binding initialized with Default::default() instead of struct constructor.

Fixes rust-lang#568

Notes:
- Checks for reassignment of one or more fields of a binding initialized with Default::default().
- Implemented using EarlyLintPass, might be future proofed better with LateLintPass.
- Does not trigger if Default::default() is used via another type implementing Default.
- This is a re-open of [PR#4761](rust-lang/rust-clippy#4761), but I couldn't figure out how to re-open that one so here's a new one with the requested changes :S
…in_unused_unit, r=ebroto

Fix suggestion to add unneeded space in `unused_unit`

Fix rust-lang/rust-clippy#6230

changelog: Fix suggestion to add unneeded space in `unused_unit`
…r=nikomatsakis

Provide diagnostic suggestion in ExprUseVisitor Delegate

The [Delegate trait](https://github.com/rust-lang/rust/blob/981346fc07dd5ef414c5b1b21999f7604cece006/compiler/rustc_typeck/src/expr_use_visitor.rs#L28-L38) currently use `PlaceWithHirId` which is composed of Hir `Place` and the
corresponding expression id.

Even though this is an accurate way of expressing how a Place is used,
it can cause confusion during diagnostics.

Eg:

```
let arr : [String; 5];

let [a, ...]     =   arr;
 ^^^ E1 ^^^      =  ^^E2^^
 ```

 Here `arr` is moved because of the binding created E1. However, when we
 point to E1 in diagnostics with the message `arr` was moved, it can be
 confusing.  Rather we would like to report E2 to the user.

 Closes: rust-lang/project-rfc-2229#20

r? `@ghost`
Rustup

r? `@ghost`

changelog: none
@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Nov 5, 2020
@Manishearth
Copy link
Member

@bors r+ p=1

@bors
Copy link
Contributor

bors commented Nov 5, 2020

📌 Commit 46c714f 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 Nov 5, 2020
@bors
Copy link
Contributor

bors commented Nov 5, 2020

⌛ Testing commit 46c714f with merge 9d78d1d...

@bors
Copy link
Contributor

bors commented Nov 5, 2020

☀️ Test successful - checks-actions
Approved by: Manishearth
Pushing 9d78d1d to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Nov 5, 2020
@bors bors merged commit 9d78d1d into rust-lang:master Nov 5, 2020
@rustbot rustbot added this to the 1.49.0 milestone Nov 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merged-by-bors This PR was explicitly merged by bors. 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.