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

Merged
merged 126 commits into from
Jul 17, 2023
Merged

Update Clippy #113686

merged 126 commits into from
Jul 17, 2023

Conversation

flip1995
Copy link
Member

y21 and others added 30 commits June 18, 2023 22:20
…would work

Also, lint question_mark for `let...else` clauses that can be simplified to use `?`.
This lint isn't perfect as it doesn't support the unstable try blocks.
…r=cjgillot

Make simd_shuffle_indices use valtrees

This removes the second-to-last user of the `destructure_mir_constant` query. So in a follow-up we can remove the query and just move the query provider function directly into pretty printing (which is the last user).

cc `@rust-lang/clippy` there's a small functional change, but I think it is correct?
Fix typos

Just a couple misc typos I found

changelog: none
Use `cargo build --tests` in CI

I noticed that we run a `cargo build` but end up downloading/building a bunch of deps after that for tests in CI

https://github.com/rust-lang/rust-clippy/actions/runs/5426673277/jobs/9869019973#step:6:12
https://github.com/rust-lang/rust-clippy/actions/runs/5426673277/jobs/9869019973#step:7:11

This builds the tests in the build step too, it may speed up runs by downloading/building more in parallel

changelog: none
…llogiq

`let_and_return`: lint 'static lifetimes, don't lint borrows in closures

Fixes rust-lang#11056

Now also ignores functions returning `'static` lifetimes, since I noticed the `stdin.lock()` example was still being linted but doesn't need to be since rust-lang#93965

changelog: none
Add `SPEEDTEST`

In the `master` branch, we currently don't have any way to test the performance of a single lint in changes.
This PR adds `SPEEDTEST`, the environment variable which lets you do a speed test on a lint / category of tests with various configuration options.

Maybe we should merge this with `lintcheck` 🤔
See the book page for more information.

changelog:none
[`missing_fields_in_debug`]: make sure self type is an adt

Fixes rust-lang#11063, another ICE that can only happen in core.

This lint needs the `DefId` of the implementor to get its fields, but that ICEs if the implementor does not have a `DefId` (as is the case with primitive types, e.g. `impl Debug for bool`), which is where this ICE comes from.

This PR changes the check I added in rust-lang#10897 to be more... robust against `Debug` implementations we don't want to lint.
Instead of just checking if the self type is a type parameter and "special casing" one specific case we don't want to lint, we should probably rather just check that the self type is either a struct, an enum or a union and only then continue.
That prevents weird edge cases like this one that can only happen in core.

Again, I don't know if it's even possible to add a test case for this since one cannot implement `Debug` for primitive types outside of the crate that defined `Debug` (core).
I did make sure that this PR no longer ICEs on `impl<T> Debug for T` and `impl Debug for bool`.
Maybe writing such a test is possible with `#![no_core]` and then re-defining the `Debug` trait or something like that...?

changelog: [`missing_fields_in_debug`]: make sure self type is an adt (fixes an ICE in core)

r? `@Alexendoo` (reviewed the last PRs for this lint)
new lint: `type_id_on_box`

Closes rust-lang#7687.

A new lint that detects calling `.type_id()` on `Box<dyn Any>` (and not on the underlying `dyn Any`), which can make up for some pretty confusing bugs!

changelog: new lint: [`type_id_on_box`]
If question_mark is allowed, there is no overlap any more,
so we can just not suppress it.
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Jul 14, 2023
@bors
Copy link
Contributor

bors commented Jul 14, 2023

🔒 Merge conflict

This pull request and the master branch diverged in a way that cannot be automatically merged. Please rebase on top of the latest master branch, and let the reviewer approve again.

How do I rebase?

Assuming self is your fork and upstream is this repository, you can resolve the conflict following these steps:

  1. git checkout clippyup (switch to your branch)
  2. git fetch upstream master (retrieve the latest master)
  3. git rebase upstream/master -p (rebase on top of it)
  4. Follow the on-screen instruction to resolve conflicts (check git status if you got lost).
  5. git push self clippyup --force-with-lease (update this PR)

You may also read Git Rebasing to Resolve Conflicts by Drew Blessing for a short tutorial.

Please avoid the "Resolve conflicts" button on GitHub. It uses git merge instead of git rebase which makes the PR commit history more difficult to read.

Sometimes step 4 will complete without asking for resolution. This is usually due to difference between how Cargo.lock conflict is handled during merge and rebase. This is normal, and you should still perform step 5 to update this PR.

Error message
Auto-merging src/tools/clippy/clippy_utils/src/ty.rs
CONFLICT (content): Merge conflict in src/tools/clippy/clippy_utils/src/ty.rs
Auto-merging src/tools/clippy/clippy_utils/src/sugg.rs
Auto-merging src/tools/clippy/clippy_utils/src/qualify_min_const_fn.rs
CONFLICT (content): Merge conflict in src/tools/clippy/clippy_utils/src/qualify_min_const_fn.rs
Auto-merging src/tools/clippy/clippy_utils/src/lib.rs
Auto-merging src/tools/clippy/clippy_utils/src/eager_or_lazy.rs
Auto-merging src/tools/clippy/clippy_utils/src/consts.rs
CONFLICT (content): Merge conflict in src/tools/clippy/clippy_utils/src/consts.rs
Removing src/tools/clippy/clippy_test_deps/src/lib.rs
Removing src/tools/clippy/clippy_test_deps/Cargo.toml
Auto-merging src/tools/clippy/clippy_lints/src/vec.rs
Auto-merging src/tools/clippy/clippy_lints/src/utils/internal_lints/msrv_attr_impl.rs
CONFLICT (content): Merge conflict in src/tools/clippy/clippy_lints/src/utils/internal_lints/msrv_attr_impl.rs
Auto-merging src/tools/clippy/clippy_lints/src/useless_conversion.rs
Auto-merging src/tools/clippy/clippy_lints/src/use_self.rs
Auto-merging src/tools/clippy/clippy_lints/src/transmute/transmute_undefined_repr.rs
CONFLICT (content): Merge conflict in src/tools/clippy/clippy_lints/src/transmute/transmute_undefined_repr.rs
Auto-merging src/tools/clippy/clippy_lints/src/size_of_in_element_count.rs
Auto-merging src/tools/clippy/clippy_lints/src/significant_drop_tightening.rs
CONFLICT (content): Merge conflict in src/tools/clippy/clippy_lints/src/significant_drop_tightening.rs
Auto-merging src/tools/clippy/clippy_lints/src/returns.rs
CONFLICT (content): Merge conflict in src/tools/clippy/clippy_lints/src/returns.rs
Auto-merging src/tools/clippy/clippy_lints/src/redundant_slicing.rs
CONFLICT (content): Merge conflict in src/tools/clippy/clippy_lints/src/redundant_slicing.rs
Auto-merging src/tools/clippy/clippy_lints/src/ptr.rs
Auto-merging src/tools/clippy/clippy_lints/src/pass_by_ref_or_value.rs
Auto-merging src/tools/clippy/clippy_lints/src/non_send_fields_in_send_ty.rs
CONFLICT (content): Merge conflict in src/tools/clippy/clippy_lints/src/non_send_fields_in_send_ty.rs
Auto-merging src/tools/clippy/clippy_lints/src/non_copy_const.rs
CONFLICT (content): Merge conflict in src/tools/clippy/clippy_lints/src/non_copy_const.rs
Auto-merging src/tools/clippy/clippy_lints/src/needless_pass_by_value.rs
Auto-merging src/tools/clippy/clippy_lints/src/methods/unnecessary_to_owned.rs
Auto-merging src/tools/clippy/clippy_lints/src/methods/unnecessary_sort_by.rs
CONFLICT (content): Merge conflict in src/tools/clippy/clippy_lints/src/methods/unnecessary_sort_by.rs
Auto-merging src/tools/clippy/clippy_lints/src/methods/needless_collect.rs
Auto-merging src/tools/clippy/clippy_lints/src/methods/mut_mutex_lock.rs
Auto-merging src/tools/clippy/clippy_lints/src/methods/mod.rs
Auto-merging src/tools/clippy/clippy_lints/src/methods/map_flatten.rs
Auto-merging src/tools/clippy/clippy_lints/src/methods/map_collect_result_unit.rs
Auto-merging src/tools/clippy/clippy_lints/src/methods/flat_map_option.rs
Auto-merging src/tools/clippy/clippy_lints/src/methods/expect_fun_call.rs
Auto-merging src/tools/clippy/clippy_lints/src/methods/err_expect.rs
Auto-merging src/tools/clippy/clippy_lints/src/methods/case_sensitive_file_extension_comparisons.rs
Auto-merging src/tools/clippy/clippy_lints/src/matches/redundant_pattern_match.rs
CONFLICT (content): Merge conflict in src/tools/clippy/clippy_lints/src/matches/redundant_pattern_match.rs
Auto-merging src/tools/clippy/clippy_lints/src/matches/match_as_ref.rs
Auto-merging src/tools/clippy/clippy_lints/src/map_unit_fn.rs
Auto-merging src/tools/clippy/clippy_lints/src/loops/missing_spin_loop.rs
Auto-merging src/tools/clippy/clippy_lints/src/let_underscore.rs
Auto-merging src/tools/clippy/clippy_lints/src/len_zero.rs
Auto-merging src/tools/clippy/clippy_lints/src/large_enum_variant.rs
Auto-merging src/tools/clippy/clippy_lints/src/iter_not_returning_iterator.rs
Auto-merging src/tools/clippy/clippy_lints/src/inherent_impl.rs
Auto-merging src/tools/clippy/clippy_lints/src/functions/must_use.rs
Auto-merging src/tools/clippy/clippy_lints/src/from_over_into.rs
Auto-merging src/tools/clippy/clippy_lints/src/derive.rs
CONFLICT (content): Merge conflict in src/tools/clippy/clippy_lints/src/derive.rs
Auto-merging src/tools/clippy/clippy_lints/src/derivable_impls.rs
Auto-merging src/tools/clippy/clippy_lints/src/dereference.rs
CONFLICT (content): Merge conflict in src/tools/clippy/clippy_lints/src/dereference.rs
Auto-merging src/tools/clippy/clippy_lints/src/default_numeric_fallback.rs
Auto-merging src/tools/clippy/clippy_lints/src/casts/as_ptr_cast_mut.rs
Auto-merging src/tools/clippy/clippy_lints/src/bool_assert_comparison.rs
CONFLICT (content): Merge conflict in src/tools/clippy/clippy_lints/src/bool_assert_comparison.rs
Automatic merge failed; fix conflicts and then commit the result.

@bors bors added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Jul 14, 2023
@bors
Copy link
Contributor

bors commented Jul 14, 2023

☔ The latest upstream changes (presumably #113591) made this pull request unmergeable. Please resolve the merge conflicts.

@Manishearth
Copy link
Member

lol

y21 and others added 5 commits July 16, 2023 21:37
…ednet

don't hide lifetimes for `LateContext`

Running `cargo dev new_lint --type methods` creates the lint file with hidden lifetimes for the `LateContext` parameter (i.e. `&LateContext`, when it should be `&LateContext<'_>`). This is already warned on with `#![warn(rust_2018_idioms)]`, so clippy should not use hidden lifetimes

changelog: none
Remove clippy_test_deps from Cargo.toml
@flip1995
Copy link
Member Author

@rustbot review

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Jul 17, 2023
@Manishearth
Copy link
Member

@bors r+

@bors
Copy link
Contributor

bors commented Jul 17, 2023

📌 Commit 8ca13e8 has been approved by Manishearth

It is now in the queue for this repository.

@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 Jul 17, 2023
@bors
Copy link
Contributor

bors commented Jul 17, 2023

⌛ Testing commit 8ca13e8 with merge 4eaad89...

@bors
Copy link
Contributor

bors commented Jul 17, 2023

☀️ Test successful - checks-actions
Approved by: Manishearth
Pushing 4eaad89 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Jul 17, 2023
@bors bors merged commit 4eaad89 into rust-lang:master Jul 17, 2023
@rustbot rustbot added this to the 1.73.0 milestone Jul 17, 2023
@rust-timer
Copy link
Collaborator

Finished benchmarking commit (4eaad89): comparison URL.

Overall result: ❌ regressions - no action needed

@rustbot label: -perf-regression

Instruction count

This is a highly reliable metric that was used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
1.0% [1.0%, 1.0%] 1
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 1.0% [1.0%, 1.0%] 1

Max RSS (memory usage)

This benchmark run did not return any relevant results for this metric.

Cycles

Results

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
2.1% [2.1%, 2.1%] 1
Regressions ❌
(secondary)
2.6% [2.6%, 2.6%] 1
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-2.4% [-2.4%, -2.4%] 1
All ❌✅ (primary) 2.1% [2.1%, 2.1%] 1

Binary size

This benchmark run did not return any relevant results for this metric.

Bootstrap: 656.866s -> 657.794s (0.14%)

@flip1995 flip1995 deleted the clippyup branch July 18, 2023 10:26
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. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)
Projects
None yet
Development

Successfully merging this pull request may close these issues.