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

Clippy subtree update #119856

Merged
merged 122 commits into from
Jan 11, 2024
Merged

Clippy subtree update #119856

merged 122 commits into from
Jan 11, 2024

Conversation

flip1995
Copy link
Member

J-ZhengLi and others added 30 commits December 13, 2023 11:09
This also updates the book's section on CI for the same thing.

changelog: none
* Fixes a typo in the name of the lint (`enforce-import-renames`
  instead of `enforced-import-renames`).
* Copyedit “Why” paragraph.
* Make the example configuration use a multi-line list, since it is not
  particularly expected that a real project will have *exactly one*
  rename to enforce (and the old formatting had unbalanced whitespace).
… r=Jarcho

Remove mitigations for incorrect node args

This change https://github.com/rust-lang/rust/pull/118420/files#r1419874371 adds a missing `write_args` to properly record node args for lang-item calls.

Thus, in the `unnecessary_to_owned` lint, this ensures that the `call_generic_args` extracted by `get_callee_generic_args_and_args` are always correct, and we can remove the mitigation for rust-lang#9504 and rust-lang#10021 since the root cause has been fixed.

I'm not sure if there is other now-unnecessary code that can be removed, but this is the one I found when investigating rust-lang/rust-clippy#11965 (comment).

changelog: none
- add a new late pass lint, with config options
- add ui tests for both variations of config option
- update CHANGELOG.md

github feedback

bump version to 1.77 and run cargo collect-metadata

Change `,` to `;` in `conf.rs`
… r=blyxyas

feature: add new lint `pub_underscore_fields`

fixes: rust-lang#10282

This PR introduces a new lint `pub_underscore_fields` that lints when a user has marked a field of a struct as public, but also prefixed it with an underscore (`_`). This is something users should avoid because the two ideas are contradictory. Prefixing a field with an `_` is inferred as the field being unused, but making a field public infers that it will be used.

- \[x] Followed [lint naming conventions][lint_naming]
  - I believe I followed the naming conventions, more than happy to update the naming if I did not :)
- \[x] Added passing UI tests (including committed `.stderr` file)
- \[x] `cargo test` passes locally
- \[x] Executed `cargo dev update_lints`
- \[x] Added lint documentation
- \[x] Run `cargo dev fmt`

---

changelog: new lint: [`pub_underscore_fields`]
[rust-lang#10283](rust-lang/rust-clippy#10283)
<!-- changelog_checked -->
…hiaskrgr

Clippy subtree update

r? `@Manishearth`
- Add a new early pass lint.
- Add relevant UI tests.
When `identity_op` identifies a `no_op`, provides a suggestion, it also
checks the type of the type of the variable. If the variable is
a reference that's been coerced into a value, e.g.

```
let x = &0i32;
let _ = x + 0;
```

the suggestion will now use a derefence. This is done by identifying
whether the variable is a reference to an integral value, and then
whether it gets dereferenced.

changelog: false positive: [`identity_op`]: corrected suggestion for
reference coerced to value.

fixes: rust-lang#12050
add external macro checks to `iter_without_into_iter` and `into_iter_without_iter`

Fixes rust-lang#12037

I think it's useful to still lint on local macros, since the user should still be able to add another impl with the `IntoIterator` or `iter` method. I think it's also fairly common to write a macro for generating many impls (e.g. for many similar types), so it'd be nice if we can continue linting in those cases.
For that reason I went with `in_external_macro`.

I also added a test for `#[allow]`ing the lint while I was at it.

changelog: [`iter_without_into_iter`]: don't lint if the `iter` method is defined in an external macro
changelog: [`into_iter_without_iter`]: don't lint if the `IntoIterator` impl is defined in an external macro
make [`mutex_atomic`] more type aware

fixes: rust-lang#9872

---

changelog: [`mutex_atomic`] now suggests more specific atomic types and skips mutex i128 and u128
GuillaumeGomez and others added 11 commits January 9, 2024 17:39
In rust-lang#119606 I added them and used a `_mv` suffix, but that wasn't great.

A `with_` prefix has three different existing uses.
- Constructors, e.g. `Vec::with_capacity`.
- Wrappers that provide an environment to execute some code, e.g.
  `with_session_globals`.
- Consuming chaining methods, e.g. `Span::with_{lo,hi,ctxt}`.

The third case is exactly what we want, so this commit changes
`DiagnosticBuilder::foo_mv` to `DiagnosticBuilder::with_foo`.

Thanks to @compiler-errors for the suggestion.
… r=llogiq

Extend `useless_asref` lint on `map(clone)`

If you have code like:

```rust
Some(String::new()).as_ref().map(Clone::clone)
```

the `as_ref` call is unneeded.

Interestingly enough, this lint and `map_clone` are starting to share a same "space" where both lints warn about different things for the same code. Not sure what's the policy about such cases though...

r? `@llogiq`

changelog: Extend `useless_asref` lint on `map(clone)`
…eviewer_rotation, r=flip1995

Remove giraffate from the reviewer rotation

I've been less active in Clippy recently because I'm so busy that I don't have time for maintaining Clippy in my spare time. So, I remove myself from the reviewer rotation once. I hope to come back again.

I'll reassign the PRs later.

changelog: none
@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jan 11, 2024
@rustbot
Copy link
Collaborator

rustbot commented Jan 11, 2024

Some changes occurred in src/tools/clippy

cc @rust-lang/clippy

@blyxyas
Copy link
Member

blyxyas commented Jan 11, 2024

Lemme just... (for a perf experiment)

@bors try @rust-timer queue scenario=clippy

@rust-timer

This comment has been minimized.

@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Jan 11, 2024
@bors
Copy link
Collaborator

bors commented Jan 11, 2024

⌛ Trying commit af39354 with merge fc01132...

bors added a commit to rust-lang-ci/rust that referenced this pull request Jan 11, 2024
@Manishearth
Copy link
Member

@bors r+ p=1

@bors
Copy link
Collaborator

bors commented Jan 11, 2024

📌 Commit af39354 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 Jan 11, 2024
@bors
Copy link
Collaborator

bors commented Jan 11, 2024

⌛ Testing commit af39354 with merge 4d31ed4...

@bors
Copy link
Collaborator

bors commented Jan 11, 2024

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

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Jan 11, 2024
@bors bors merged commit 4d31ed4 into rust-lang:master Jan 11, 2024
@rustbot rustbot added this to the 1.77.0 milestone Jan 11, 2024
@rust-timer
Copy link
Collaborator

Finished benchmarking commit (4d31ed4): comparison URL.

Overall result: ✅ improvements - 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)
- - 0
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-1.9% [-1.9%, -1.9%] 1
All ❌✅ (primary) - - 0

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

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)
0.7% [0.5%, 0.9%] 2
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 0.7% [0.5%, 0.9%] 2

Binary size

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

Bootstrap: 665.796s -> 664.291s (-0.23%)
Artifact size: 308.37 MiB -> 308.42 MiB (0.02%)

@blyxyas blyxyas removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Jan 19, 2024
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.