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

Merged
merged 99 commits into from
Mar 10, 2023
Merged

Update Clippy #108974

merged 99 commits into from
Mar 10, 2023

Conversation

flip1995
Copy link
Member

r? @Manishearth

cc @m-ou-se This sync also includes rust-lang/rust-clippy#10275

c410-f3r and others added 30 commits February 12, 2023 17:34
(This is a large commit. The changes to
`compiler/rustc_middle/src/ty/context.rs` are the most important ones.)

The current naming scheme is a mess, with a mix of `_intern_`, `intern_`
and `mk_` prefixes, with little consistency. In particular, in many
cases it's easy to use an iterator interner when a (preferable) slice
interner is available.

The guiding principles of the new naming system:
- No `_intern_` prefixes.
- The `intern_` prefix is for internal operations.
- The `mk_` prefix is for external operations.
- For cases where there is a slice interner and an iterator interner,
  the former is `mk_foo` and the latter is `mk_foo_from_iter`.

Also, `slice_interners!` and `direct_interners!` can now be `pub` or
non-`pub`, which helps enforce the internal/external operations
division.

It's not perfect, but I think it's a clear improvement.

The following lists show everything that was renamed.

slice_interners
- const_list
  - mk_const_list -> mk_const_list_from_iter
  - intern_const_list -> mk_const_list
- substs
  - mk_substs -> mk_substs_from_iter
  - intern_substs -> mk_substs
  - check_substs -> check_and_mk_substs (this is a weird one)
- canonical_var_infos
  - intern_canonical_var_infos -> mk_canonical_var_infos
- poly_existential_predicates
  - mk_poly_existential_predicates -> mk_poly_existential_predicates_from_iter
  - intern_poly_existential_predicates -> mk_poly_existential_predicates
  - _intern_poly_existential_predicates -> intern_poly_existential_predicates
- predicates
  - mk_predicates -> mk_predicates_from_iter
  - intern_predicates -> mk_predicates
  - _intern_predicates -> intern_predicates
- projs
  - intern_projs -> mk_projs
- place_elems
  - mk_place_elems -> mk_place_elems_from_iter
  - intern_place_elems -> mk_place_elems
- bound_variable_kinds
  - mk_bound_variable_kinds -> mk_bound_variable_kinds_from_iter
  - intern_bound_variable_kinds -> mk_bound_variable_kinds

direct_interners
- region
  - intern_region (unchanged)
- const
  - mk_const_internal -> intern_const
- const_allocation
  - intern_const_alloc -> mk_const_alloc
- layout
  - intern_layout -> mk_layout
- adt_def
  - intern_adt_def -> mk_adt_def_from_data (unusual case, hard to avoid)
  - alloc_adt_def(!) -> mk_adt_def
- external_constraints
  - intern_external_constraints -> mk_external_constraints

Other
- type_list
  - mk_type_list -> mk_type_list_from_iter
  - intern_type_list -> mk_type_list
- tup
  - mk_tup -> mk_tup_from_iter
  - intern_tup -> mk_tup
Do not suggest using Self in const generic parameters

Fixes rust-lang#10371

changelog: FP: [`use_self`]: do not suggest using `Self` in const generic parameters
…rcho

chore: remove unneeded rustfmt skip

---

The associated rustfmt bug that originally necessitated these skips was resolved a while back, so these are no longer necessary

changelog: none
It was probably a leftover from the old `?` desugaring but anyways, it's
unused now except for clippy, which can just use a diagnostics item.
…as From˂˂LangItemFromFn˃˃˃꞉꞉from, r=cjgillot

Remove `from` lang item

It was probably a leftover from the old `?` desugaring but anyways, it's unused now except for clippy, which can just use a diagnostics item.
Update Clippy

Seems like `@flip1995` so this is a couple days late.

r? `@Manishearth`
…r=Alexendoo

exit lint: potentualy -> potentially

changelog: none
Do not suggest to derive `Default` on generics with implicit arguments

Fixes rust-lang#10396

changelog: FP: [`derivable_impls`]: do not suggest to derive `Default` on generics with implicit arguments
…p1995

Fix array-size-threshold config deserialization error

changelog: Fix error when providing an `array-size-threshold` in `clippy.toml`

Not entirely sure why it doesn't want to deserialize a u128, but converting it after the fact is an easy enough fix

Fixes rust-lang#10422
Fix ICE in `multiple_unsafe_ops_per_block`

fixes rust-lang#10367

changelog: [`multiple_unsafe_ops_per_block`]: Fix ICE when calling a function-like object in an unsafe block
Run dogfood to completion

Run dogfood on all packages before failing the test. Failing early is painful on lints which trigger on multiple crates.

changelog: None
…cs, r=dswij

Scope `missing_docs_in_private_items` to only private items

`missing_docs_in_private_items` currently detects missing docs for public items as well as private. Since `missing_docs`already covers public items, this PR updates `missing_docs_in_private_items` to only cover private items.

Fixes rust-lang#1895

changelog: [`missing_docs_in_private_items`]: Apply lint only to private items (used to be public and private)
Two small documentation improvements

The `wrong_self_convention` changes are for grammar and accuracy.

The `must_use_candidate` change is because that lint flags only exported functions: https:/rust-lang/rust-clippy/blob/8b65632b6ef737979d42f83664271d6baa8c0270/clippy_lints/src/functions/must_use.rs#L27-L31

changelog: `wrong_self_convention` and `must_use_candidate` documentation improvements
bors and others added 14 commits March 9, 2023 13:30
[arithmetic_side_effects] Fix rust-lang#10252

Fix rust-lang#10252

At least for integers, shifts are already handled by the compiler.

----

changelog: [`arithmetic_side_effects`]: No longer lints on right or left shifts with constant integers, as the compiler warns about them.
[rust-lang#10309](rust-lang/rust-clippy#10309)
<!-- changelog_checked-->
Add `let_with_type_underscore` lint

Fixes rust-lang#10463
changelog: [`let_with_type_underscore`]: Add the lint.
…k, r=llogiq

lintcheck: use multithreading unless --fix or --recursive is used

Use multithreading unless there is a reason not to.

changelog: none
Include async functions in the len_without_is_empty

fixes rust-lang#7232

Changes done to the functionality:

Allowing different error types for the functions was disallowed. So the following was linted before but is not after this change
```
impl Foo {
    pub len(&self) -> Result<usize, Error1> { todo!(); }
    pub is_empty(&self) -> Result<bool, Error2> { todo!(); }
}
```

---

changelog: Enhancement: [`len_without_is_empty`]: Now also detects `async` functions
[rust-lang#10359](rust-lang/rust-clippy#10359)
<!-- changelog_checked -->
…ed, r=flip1995

Mark Rust 1.68.0 as release in the changelog

Roses are red,
this poem is dead,
my creativity is lost,
outside there is frost?

Maybe I should really stop including a "roses are red" with every changelog PR. These are getting worse every time...

---

changelog: none
<!-- changelog_checked -->
Migrate `write.rs` to `rustc_ast::FormatArgs`

changelog: none

Part 1 of rust-lang#10233

The additions to `clippy_utils` are the main novelty of this PR, there's no removals yet since other parts still rely on `FormatArgsExpn`

The changes to `write.rs` itself are relatively straightforward this time around, as there's no lints in it that rely on type checking format params

r? `@flip1995`
@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Mar 10, 2023
@rustbot
Copy link
Collaborator

rustbot commented Mar 10, 2023

These commits modify the Cargo.lock file. Random changes to Cargo.lock can be introduced when switching branches and rebasing PRs.
This was probably unintentional and should be reverted before this PR is merged.

If this was intentional then you can ignore this comment.

Some changes occurred in src/tools/clippy

cc @rust-lang/clippy

@Manishearth
Copy link
Member

@bors r+ p=1 rollup=never

@bors
Copy link
Contributor

bors commented Mar 10, 2023

📌 Commit a87abc2 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 Mar 10, 2023
@bors
Copy link
Contributor

bors commented Mar 10, 2023

⌛ Testing commit a87abc2 with merge ff4b772...

@bors
Copy link
Contributor

bors commented Mar 10, 2023

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

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Mar 10, 2023
@bors bors merged commit ff4b772 into rust-lang:master Mar 10, 2023
@rustbot rustbot added this to the 1.70.0 milestone Mar 10, 2023
@rust-timer
Copy link
Collaborator

Finished benchmarking commit (ff4b772): comparison URL.

Overall result: no relevant changes - no action needed

@rustbot label: -perf-regression

Instruction count

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

Max RSS (memory usage)

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)
- - 0
Regressions ❌
(secondary)
1.1% [1.1%, 1.1%] 1
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) - - 0

Cycles

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

flip1995 pushed a commit to flip1995/rust that referenced this pull request Mar 24, 2023
Update Clippy

r? `@Manishearth`

cc `@m-ou-se` This sync also includes rust-lang/rust-clippy#10275
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.