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

Merged
merged 117 commits into from
Jun 13, 2024
Merged

Clippy subtree update #126398

merged 117 commits into from
Jun 13, 2024

Conversation

flip1995
Copy link
Member

r? @Manishearth

Updates Cargo.lock with Clippy version bump.

Alexendoo and others added 30 commits April 14, 2024 14:43
Almost all callers want this anyway, and now we can use it to also return fed bodies
Note that semantics of repeat expr in array are the same
Make `body_owned_by` return the `Body` instead of just the `BodyId`

fixes rust-lang#125677

Almost all `body_owned_by` callers immediately called `body`, too, so just return `Body` directly.

This makes the inline-const query feeding more robust, as all calls to `body_owned_by` will now yield a body for inline consts, too.

I have not yet figured out a good way to make `tcx.hir().body()` return an inline-const body, but that can be done as a follow-up
Make `body_owned_by` return the `Body` instead of just the `BodyId`

fixes rust-lang#125677

Almost all `body_owned_by` callers immediately called `body`, too, so just return `Body` directly.

This makes the inline-const query feeding more robust, as all calls to `body_owned_by` will now yield a body for inline consts, too.

I have not yet figured out a good way to make `tcx.hir().body()` return an inline-const body, but that can be done as a follow-up
…iaskrgr

Rollup of 7 pull requests

Successful merges:

 - rust-lang#125342 (Document platform-specifics for `Read` and `Write` of `File`)
 - rust-lang#125711 (Make `body_owned_by` return the `Body` instead of just the `BodyId`)
 - rust-lang#125739 (drop_in_place: weaken the claim of equivalence with drop(ptr.read()))
 - rust-lang#125745 (Bump the stage0 compiler to beta.7 (2024-05-26))
 - rust-lang#125746 (Fix copy-paste error in `Duration::from_weeks` panic message.)
 - rust-lang#125753 (compiletest: Unify `cmd2procres` with `run_command_to_procres`)
 - rust-lang#125754 (coverage: Rename MC/DC `conditions_num` to `num_conditions`)

r? `@ghost`
`@rustbot` modify labels: rollup
ignore array from `deref_addrof` lint

Split from rust-lang/rust-clippy#12854

changelog: ignore array from `deref_addrof` lint

r? y21
Signed-off-by: VitalikButerinEth <[email protected]>
fix: let non_canonical_impls skip proc marco

Fixed rust-lang#12788

Although the issue only mentions `NON_CANONICAL_CLONE_IMPL`, this fix will also affect `NON_CANONICAL_PARTIAL_ORD_IMPL` because I saw
> Because of these unforeseeable or unstable behaviors, macro expansion should often not be regarded as a part of the stable API.

on Clippy Documentation and these two lints are similar, so I think it might be good, not sure if it's right or not.

---

changelog: `NON_CANONICAL_CLONE_IMPL`, `NON_CANONICAL_PARTIAL_ORD_IMPL` will skip proc marco now
…nishearth

Clippy subtree update

r? `@Manishearth`
matthiaskrgr and others added 15 commits June 10, 2024 21:12
Normalize type aliases when checking significant drops.

fixes rust-lang#10750

No test as I'm not sure exactly how the type alias caused a stack overflow here. Also removes an unnecessary `HashSet`.

changelog: none
Filter from first typed symbol on gh-pages

Cosmetic fix
Don't see the reason that now filter on gh-pages is starting work after 3 symbols typing so remove this condition

Before:

https://github.com/rust-lang/rust-clippy/assets/5480441/fa3b780e-30dc-4fdb-bf2d-5a99337eca4e

After:

https://github.com/rust-lang/rust-clippy/assets/5480441/977e15af-8be5-462c-a703-f10c05e6109c

changelog: gh-pages
… r=xFrednet

Handle single chars with `to_string()` for `single_char_add_str`

Add support for single chars / literals with `to_string()` call for `push_str()` and `insert_str()`.

changelog: [`single_char_add_str`]: handle single chars with `to_string()` call

Closes rust-lang#12775
Don't lint indexing_slicing lints on proc macros

This pr fixes rust-lang/rust-clippy#12824

Even though the issue mentions the indexing case only, it was easy to apply the fix to the slicing case as well.

changelog: [`out_of_bounds_indexing`, `indexing_slicing`]: Don't lint on procedural macros.
…tern, r=Alexendoo

Add lint to check manual pattern char comparison

This PR adds a new lint asked in rust-lang/rust-clippy#12490

This lint catches manual char comparison in pattern of string functions and propose to use `char` or array of `char` instead.

As it's my first contribution i'm not feeling very safe about not matching too much or missing some cases.

Thanks in advance for taking time to review and propose feedback !

changelog: new lint [`manual_pattern_char_comparison`]
Let `qualify_min_const_fn` deal with drop terminators

Fixes rust-lang#12677

The `method_accepts_droppable` check that was there seemed overly conservative.
> Returns true if any of the method parameters is a type that implements `Drop`.
> The method can't be made const then, because `drop` can't be const-evaluated.

Accepting parameters that implement `Drop` should still be fine as long as the parameter isn't actually dropped, as is the case in the linked issue where the droppable is moved into the return place. This more accurate analysis ("is there a `drop` terminator") is already done by `qualify_min_const_fn` [here](https://github.com/rust-lang/rust-clippy/blob/f5e250180c342bb52808c9a934c962a8fe40afc7/clippy_utils/src/qualify_min_const_fn.rs#L298), so I don't think this additional check is really necessary?

Fixing the other, second case in the linked issue was only slightly more involved, since `Vec::new()` is a function call that has the ability to panic, so there must be a `drop()` terminator for cleanup, however we should be able to freely ignore that. [Const checking ignores cleanup blocks](https://github.com/rust-lang/rust/blob/master/compiler/rustc_const_eval/src/transform/check_consts/check.rs#L382-L388), so we should, too?

r? `@Jarcho`

----

changelog: [`missing_const_for_fn`]: continue linting on fns with parameters implementing `Drop` if they're not actually dropped
Fix typos of author lint

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

rustbot commented Jun 13, 2024

These commits modify the Cargo.lock file. Unintentional changes to Cargo.lock can be introduced when switching branches and rebasing PRs.

If this was unintentional then you should revert the changes before this PR is merged.
Otherwise, you can ignore this comment.

Some changes occurred in src/tools/clippy

cc @rust-lang/clippy

@Manishearth
Copy link
Member

@bors r+ p=1

@bors
Copy link
Contributor

bors commented Jun 13, 2024

📌 Commit 17d2856 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 Jun 13, 2024
@matthiaskrgr
Copy link
Member

@bors p=10 yeet! (over the rollup)

@bors
Copy link
Contributor

bors commented Jun 13, 2024

⌛ Testing commit 17d2856 with merge f158600...

@bors
Copy link
Contributor

bors commented Jun 13, 2024

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

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Jun 13, 2024
@bors bors merged commit f158600 into rust-lang:master Jun 13, 2024
7 checks passed
@rustbot rustbot added this to the 1.81.0 milestone Jun 13, 2024
@rust-timer
Copy link
Collaborator

Finished benchmarking commit (f158600): 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 (primary 1.2%)

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

Cycles

Results (primary 2.9%)

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.9% [0.9%, 5.9%] 10
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 2.9% [0.9%, 5.9%] 10

Binary size

Results (secondary -0.0%)

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

Bootstrap: 671.147s -> 671.518s (0.06%)
Artifact size: 320.41 MiB -> 320.38 MiB (-0.01%)

flip1995 pushed a commit to flip1995/rust that referenced this pull request Jun 27, 2024
…nishearth

Clippy subtree update

r? `@Manishearth`

Updates `Cargo.lock` with Clippy version bump.
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.