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

Merged
merged 79 commits into from
May 2, 2024
Merged

Clippy subtree update #124621

merged 79 commits into from
May 2, 2024

Conversation

flip1995
Copy link
Member

@flip1995 flip1995 commented May 2, 2024

bend-n and others added 30 commits March 20, 2024 23:33
…ass_by_ref_mut, r=Manishearth

Emit the `needless_pass_by_ref_mut` lint on `self` arguments as well

Fixes rust-lang/rust-clippy#12589.
Fixes rust-lang/rust-clippy#9591.

The first commit fixes a bug I uncovered while working on this: sometimes, the mutable borrow "event" happens before the alias one, which makes some argument detected as not used mutably even if they are. The fix was simply to fill the map with the aliases afterwards.

The second commit removes the restriction to not run `self` argument for the `needless_pass_by_ref_mut` lint.

changelog: emit the `needless_pass_by_ref_mut` lint on `self` arguments as well

r? `@Manishearth`
…hable initializers

This commit introduces a check to ensure that the lint won't trigger when the initializer is
unreachable, such as:

```
thread_local! {
    static STATE: Cell<usize> = panic!();
}
```

This is achieved by looking at the unpeeled initializer expression and ensuring that the parent
macro is not `panic!()`, `todo!()`, `unreachable!()`, `unimplemented!()`.

fixes rust-lang#12637

changelog: [`threadlocal_initializer_can_be_made_const`] will no longer trigger on `unreachable` macros.
Threadlocal_initializer_can_be_made_const will not trigger for unreachable initializers

This commit introduces a check to ensure that the lint won't trigger when the initializer is unreachable, such as:

```
thread_local! {
    static STATE: Cell<usize> = panic!();
}
```

This is achieved by looking at the unpeeled initializer expression and ensuring that the parent macro is not `panic!()`, `todo!()`, `unreachable!()`, `unimplemented!()`.

fixes rust-lang#12637

changelog: [`threadlocal_initializer_can_be_made_const`] will no longer trigger on `unreachable` macros.
…indirect, r=llogiq

Rework interior mutability detection

Replaces the existing interior mutability detection, the two main changes being

- It now follows references/pointers e.g. `struct S(&Cell)`
  - `mutable_key_type` ignores pointers as it did before
- The `ignore_interior_mutability` config now applies to types containing the ignored type, e.g. `http::HeaderName`

Fixes rust-lang/rust-clippy#7752
Fixes rust-lang/rust-clippy#9776
Fixes rust-lang/rust-clippy#9801

changelog: [`mutable_key_type`], [`declare_interior_mutable_const`]: now considers types that have references to interior mutable types as interior mutable
…on, r=Alexendoo

Fix `is_test_module_or_function`

The rustdoc comment for `is_test_module_or_function` states: https://github.com/rust-lang/rust-clippy/blob/2795a6018944a5918b7d276267165484f5d62d6a/clippy_utils/src/lib.rs#L2561-L2566

Given `item`, the function calls `is_in_test_function` with `item.hir_id()`. However, `is_in_test_function` considers only `item`'s parents, not `item` itself. This PR fixes the problem.

The `test_with_disallowed_name` test fails without the fix, but passes once applied.

changelog: none
…nly, r=xFrednet

reduce `single_char_pattern` to only lint on ascii chars

This should mostly fix the `single_char_pattern` lint, because with a single byte, the optimizer will usually see through the char-to-string-expansion and single loop iteration. This fixes rust-lang#11675 and rust-lang#8111.

Update: As per the meeting on November 28th, 2023, we voted to also downgrade the lint to pedantic.

---

changelog: downgrade [`single_char_pattern`] to `pedantic`
[arithmetic_side_effects] Fix rust-lang#12318

Fix rust-lang#12318

changelog: [arithmetic_side_effects]: Consider method calls that correspond to arithmetic symbols
…s, r=jackh726

`has_typeck_results` doesnt need to be a query

self-explanatory
…s, r=davidtwco

Disallow ambiguous attributes on expressions

This implements the suggestion in [rust-lang#15701](rust-lang#15701 (comment)) to disallow ambiguous outer attributes on expressions. This should resolve one of the concerns blocking the stabilization of `stmt_expr_attributes`.
chore: fix some typos in comments

*Please write a short comment explaining your change (or "none" for internal only changes)*

changelog: none
CBSpeir and others added 14 commits May 1, 2024 22:23
Both clippy_utils::paths::SLICE_GET and clippy_utils::paths::STR_BYTES
are dead_code and can therefore be removed.
Changelog for Clippy 1.78 🪄

Roses and Violets have colors,
Red and Blue are the two,
I'm getting to the end of my masters,
what a cool goal to pursue

---

### The cat of this release is: *Shadow* submitted by `@benwh1:`

<img height=500 src="https://github.com/rust-lang/rust-clippy/assets/32911992/c56af314-4644-482a-a08e-f32f4c7d7b22" alt="The cats of this Clippy release" />

Cats for the next release can be nominated in the comments :D

---

changelog: none
Bump ui_test to 0.23

Notable changes: more control over run/rustfix/... and other rustc-specific features. All of these can in theory now be implemented entirely out of tree

changelog: none
fix `for x in y unsafe { }`

fixes rust-lang#12514

----

changelog: [`needless_for_each`]: unsafe block in for loop body suggestion
Remove `dead_code` paths

The following paths are `dead_code` and can be removed:

### `clippy_utils::paths::VEC_RESIZE`
* Introduced when `vec_resize_to_zero` lint added in PR rust-lang/rust-clippy#5637
* No longer used after commit rust-lang/rust-clippy@8acc4d2
### `clippy_utils::paths::SLICE_GET`
* Introduced when `get_first` lint added in PR rust-lang/rust-clippy#8882
* No longer used after commit rust-lang/rust-clippy@a8d80d5
### `clippy_utils::paths::STR_BYTES`
* Introduced when `bytes_count_to_len` lint added in PR rust-lang/rust-clippy#8711
* No longer used after commit rust-lang/rust-clippy@ba6a459

When the lints were moved into the `Methods` lint pass, they switched from using paths to diagnostic items.  However, the paths were never removed.  This occurred in PR rust-lang/rust-clippy#8957.

This relates to issue rust-lang/rust-clippy#5393

changelog: none
Suggest collapsing nested or patterns if the MSRV allows it

Nested `or` patterns have been stable since 1.53, so we should be able to suggest `Some(1 | 2)` if the MSRV isn't set below that.

This change adds an msrv check and also moves it to `matches/mod.rs`, because it's also needed by `redundant_guards`.

changelog: [`collapsible_match`]: suggest collapsing nested or patterns if the MSRV allows it
@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label May 2, 2024
@rustbot
Copy link
Collaborator

rustbot commented May 2, 2024

Some changes occurred in src/tools/clippy

cc @rust-lang/clippy

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.

@Manishearth
Copy link
Member

@bors r+ p=1

@bors
Copy link
Contributor

bors commented May 2, 2024

📌 Commit e395dc9 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 May 2, 2024
@bors
Copy link
Contributor

bors commented May 2, 2024

⌛ Testing commit e395dc9 with merge a8773d5...

@bors
Copy link
Contributor

bors commented May 2, 2024

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

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label May 2, 2024
@bors bors merged commit a8773d5 into rust-lang:master May 2, 2024
7 checks passed
@rustbot rustbot added this to the 1.80.0 milestone May 2, 2024
@flip1995 flip1995 deleted the clippy-subtree-update branch May 2, 2024 18:23
@rust-timer
Copy link
Collaborator

Finished benchmarking commit (a8773d5): 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)
3.7% [3.7%, 3.7%] 1
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 3.7% [3.7%, 3.7%] 1

Cycles

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

Binary size

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

Bootstrap: 674.97s -> 677.471s (0.37%)
Artifact size: 315.95 MiB -> 315.97 MiB (0.01%)

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.