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

Merged
merged 80 commits into from
Sep 10, 2020
Merged

Update Clippy #76574

merged 80 commits into from
Sep 10, 2020

Conversation

flip1995
Copy link
Member

Biweekly Clippy update

r? @Manishearth

tnielens and others added 30 commits August 21, 2020 00:42
…lf awaitable.

This catches bugs of the form

tokio::spawn(async move {
    let f = some_async_thing();
    f // Oh no I forgot to await f so that work will never complete.
});
Syntax-highlight `single_char_push_str` lint

It wasn't being syntax highlighted in the online lint index:

![image](https://user-images.githubusercontent.com/37223377/91666682-8fc02000-eab3-11ea-95fa-6671472712c8.png)

changelog: none
or_fn_call: ignore nullary associated const fns

The fix in rust-lang#5889 was missing associated functions.

changelog: Ignore also `const fn` methods in [`or_fun_call`]

Fixes rust-lang#5693
Add a lint for an async block/closure that yields a type that is itself awaitable.

This catches bugs of the form

tokio::spawn(async move {
    let f = some_async_thing();
    f // Oh no I forgot to await f so that work will never complete.
});

See the two XXXkhuey comments and the unfixed `_l` structure for things that need more thought.

*Please keep the line below*
changelog: none
…apsible_if, r=yaahc

Fix the wrong suggestion when using macro in `collapsible_if`

Fix rust-lang#5962

changelog: Fix the wrong suggestion when using macro in `collapsible_if`
Avoid firing the lint when `transmute` in const contexts
as dereferencing raw pointers in consts is unstable. cc rust-lang#5959
Don't emit a lint when the pushed item doesn't have Clone trait
default_trait_access: Fix wrong suggestion

rust-lang/rust-clippy#5975 (comment)
> I think the underlying problem is clippy suggests code with complete parameters, not clippy triggers this lint even for complex types. AFAIK, If code compiles with `Default::default`, it doesn't need to specify any parameters, as type inference is working. (So, in this case, `default_trait_access` should suggest `RefCell::default`.)

Fixes rust-lang#5975 Fixes rust-lang#5990

changelog: `default_trait_access`: fixed wrong suggestion
…in_consts, r=ebroto

Fix a fp in `transmute_ptr_to_ptr`

fixes rust-lang#5959

changelog: Fix a false positive in `transmute_ptr_to_ptr` that the lint fires when `transmute` is used to cast a reference in const contexts although dereferencing raw pointers in consts is unstable.
ebroto and others added 14 commits September 8, 2020 22:26
Rustup

r? `@ghost`

changelog: none
…broto

Restrict `same_item_push` to suppress false positives

It only emits a lint when the pushed item is a literal, a constant and an immutable binding that are initialized with those, as discussed in rust-lang/rust-clippy#5997 (review).

Fix rust-lang/rust-clippy#5985

changelog: Restrict `same_item_push` to literals, constants and immutable bindings that are initialized with those.

r? `@ebroto`
We no longer lint assignments to const item fields in the
`temporary_assignment` lint, since this is now covered by the
`CONST_ITEM_MUTATION` lint.

Additionally, we `#![allow(const_item_mutation)]` in the
`borrow_interior_mutable_const.rs` test. Clippy UI tests are run with
`-D warnings`, which seems to cause builtin lints to prevent Clippy
lints from running.
…, r=oli-obk

Add CONST_ITEM_MUTATION lint

Fixes rust-lang#74053
Fixes rust-lang#55721

This PR adds a new lint `CONST_ITEM_MUTATION`.
Given an item `const FOO: SomeType = ..`, this lint fires on:

* Attempting to write directly to a field (`FOO.field = some_val`) or
  array entry (`FOO.array_field[0] = val`)
* Taking a mutable reference to the `const` item (`&mut FOO`), including
  through an autoderef `FOO.some_mut_self_method()`

The lint message explains that since each use of a constant creates a
new temporary, the original `const` item will not be modified.
print the unit type `()` in related lint messages.

changelog: print the unit type `()` in related lint messages
Rustup

r? `@ghost`

changelog: none
link to the Box docs in related lint documentation.

changelog: link to the box docs in lint docs
improve the suggestion of the lint `unit-arg`

Fixes rust-lang#5823
Fixes rust-lang#6015

Changes
```
help: move the expression in front of the call...
  |
3 |     g();
  |
help: ...and use a unit literal instead
  |
3 |     o.map_or((), |i| f(i))
  |
```
into
```
help: move the expression in front of the call and replace it with the unit literal `()`
  |
3 |     g();
  |     o.map_or((), |i| f(i))
  |
```
changelog: improve the suggestion of the lint `unit-arg`
Add a lint to prevent `create_dir` from being used

This closes rust-lang#5950
changelog: none
@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Sep 10, 2020
@Manishearth
Copy link
Member

@bors r+

@bors
Copy link
Contributor

bors commented Sep 10, 2020

📌 Commit ca6c695 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 Sep 10, 2020
@tmandry
Copy link
Member

tmandry commented Sep 10, 2020

Do these still get prioritized or did we change that?

@Manishearth
Copy link
Member

@bors p=1

it's less pressing to prioritize them now that it's using subtree but no harm in doing so anyway

@tmandry
Copy link
Member

tmandry commented Sep 10, 2020

Makes sense, just wondered.

@bors
Copy link
Contributor

bors commented Sep 10, 2020

⌛ Testing commit ca6c695 with merge a1947b3...

@bors
Copy link
Contributor

bors commented Sep 10, 2020

☀️ Test successful - checks-actions, checks-azure
Approved by: Manishearth
Pushing a1947b3 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Sep 10, 2020
@bors bors merged commit a1947b3 into rust-lang:master Sep 10, 2020
@rustbot rustbot added this to the 1.48.0 milestone Sep 10, 2020
@flip1995 flip1995 deleted the clippyup branch September 11, 2020 13:57
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.