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

Merged
merged 144 commits into from
Mar 22, 2024
Merged

Clippy subtree update #122845

merged 144 commits into from
Mar 22, 2024

Conversation

flip1995
Copy link
Member

nbdd0121 and others added 30 commits February 24, 2024 18:49
Have the lint trigger even if `Self` has generic lifetime parameters.

```rs
impl<'a> Foo<'a> {
    type Item = Foo<'a>; // Can be replaced with Self

    fn new() -> Self {
        Foo { // No lifetime, but they are inferred to be that of Self
              // Can be replaced as well
            ...
        }
    }

    // Don't replace `Foo<'b>`, the lifetime is different!
    fn eq<'b>(self, other: Foo<'b>) -> bool {
        ..
    }
```

Fixes rust-lang#12381
Add asm goto support to `asm!`

Tracking issue: rust-lang#119364

This PR implements asm-goto support, using the syntax described in "future possibilities" section of [RFC2873](https://rust-lang.github.io/rfcs/2873-inline-asm.html#asm-goto).

Currently I have only implemented the `label` part, not the `fallthrough` part (i.e. fallthrough is implicit). This doesn't reduce the expressive though, since you can use label-break to get arbitrary control flow or simply set a value and rely on jump threading optimisation to get the desired control flow. I can add that later if deemed necessary.

r? ``@Amanieu``
cc ``@ojeda``
fix [`missing_docs_in_private_items`] on some proc macros

fixes: rust-lang#12197

---

changelog: [`missing_docs_in_private_items`] support manually search for docs as fallback method
…enkov

Refactor pre-getopts command line argument handling

Rebased version of rust-lang#111658. I've also fixed the Windows CI failure (although I don't have access to Windows to test it myself).
Lint singleton gaps after exclusive ranges

In the discussion to stabilize exclusive range patterns (rust-lang#37854), it has often come up that they're likely to cause off-by-one mistakes. We already have the `overlapping_range_endpoints` lint, so I [proposed](rust-lang#37854 (comment)) a lint to catch the complementary mistake.

This PR adds a new `non_contiguous_range_endpoints` lint that catches likely off-by-one errors with exclusive range patterns. Here's the idea (see the test file for more examples):
```rust
match x {
    0..10 => ..., // WARN: this range doesn't match `10_u8` because `..` is an exclusive range
    11..20 => ..., // this could appear to continue range `0_u8..10_u8`, but `10_u8` isn't matched by either of them
    _ => ...,
}
// help: use an inclusive range instead: `0_u8..=10_u8`
```

More precisely: for any exclusive range `lo..hi`, if `hi+1` is matched by another range but `hi` isn't, we suggest writing an inclusive range `lo..=hi` instead. We also catch `lo..T::MAX`.
New lint `const_is_empty`

This lint detects calls to `.is_empty()` on an entity initialized from a string literal and flag them as suspicious. To avoid triggering on macros called from generated code, it checks that the `.is_empty()` receiver, the call itself and the initialization come from the same context.

Fixes rust-lang#12307

changelog: [`const_is_empty`]: new lint
bors and others added 13 commits March 20, 2024 20:41
…r=Alexendoo

Make `assigning_clones` MSRV check more precise

Continuation of rust-lang#12511

`clone_into` is the only suggestion subject to the 1.63 MSRV requirement, and the lint should still emit other suggestions regardless of the MSRV.

changelog: [assigning_clones]: only apply MSRV check to `clone_into` suggestions.
Disable `cast_lossless` when casting to u128 from any (u)int type

Fixes rust-lang/rust-clippy#12492

Disables `cast_lossless` when casting to u128 from any int or uint type. The lint states that when casting to any int type, there can potentially be lossy behaviour if the source type ever exceeds the size of the destination type in the future, which is impossible with a destination of u128.

It's possible this is a bit of a niche edge case which is better addressed by just disabling the lint in code, but I personally couldn't think of any good reason to still lint in this specific case - maybe except if the source is a bool, for readability reasons :).

changelog: FP: `cast_lossless`: disable lint when casting to u128 from any (u)int type
Changelog for Clippy 1.77 🏫

Roses are violets,
Red is blue,
Let's create a world,
Perfect for me and you

---

### The cat of this release is: *Luigi*

<img width=500 src="https://github.com/rust-lang/rust-clippy/assets/17087237/ea13d05c-e5ba-4189-9e16-49bf1b43c468" alt="The cats of this Clippy release" />

The cat for the next release can be voted on: [here](https://forms.gle/57gbrNvXtCUmrHYh6)

The cat for the next next release can be nominated in the comments and will be voted in the next changelog PR (Submission deadline is 2024-03-30 23:59CET)

---

changelog: none
Add xFrednet back to the reviewing rotation 🎉

You know what? Having a work-life balance is boring.

I truly enjoyed having a free few weeks, and learned that I need to take a break every once in a while, but not doing reviews feels weird. So, this is me coming back for more :D

---

r? `@ghost`

changelog: none
Fix documentation typo "appects" > "affects"

changelog: none

This fixes a typo in the `iter_filter_is_some` and `iter_filter_is_ok` lint documentation.
@rustbot
Copy link
Collaborator

rustbot commented Mar 21, 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.

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Mar 21, 2024
@matthiaskrgr
Copy link
Member

yoink!
r? @matthiaskrgr

@bors r+ p=1

@bors
Copy link
Contributor

bors commented Mar 21, 2024

📌 Commit 8e53d53 has been approved by matthiaskrgr

It is now in the queue for this repository.

@rustbot rustbot assigned matthiaskrgr and unassigned Manishearth Mar 21, 2024
@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 21, 2024
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Mar 21, 2024
…matthiaskrgr

Clippy subtree update

r? `@Manishearth`
bors added a commit to rust-lang-ci/rust that referenced this pull request Mar 22, 2024
…iaskrgr

Rollup of 11 pull requests

Successful merges:

 - rust-lang#121881 (std::net: adding acceptfilter feature for netbsd/freebsd.)
 - rust-lang#122817 (Doc Guarantee: BTree(Set|Map):  `IntoIter` Iterate in Sorted by key Order)
 - rust-lang#122826 (Add tests for shortcomings of associated type bounds)
 - rust-lang#122829 (Implement `FusedIterator` for `gen` block)
 - rust-lang#122831 (make failure logs less verbose)
 - rust-lang#122837 (add test for rust-lang#122549)
 - rust-lang#122838 (Avoid noop rewrite of issues.txt)
 - rust-lang#122841 (add 2 more tests for issues fixed by rust-lang#122749)
 - rust-lang#122843 (Add a never type option to make diverging blocks `()`)
 - rust-lang#122844 (add test for ice "cannot relate region: LUB(ReErased, ReError)")
 - rust-lang#122845 (Clippy subtree update)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 99e5618 into rust-lang:master Mar 22, 2024
11 checks passed
@rustbot rustbot added this to the 1.79.0 milestone Mar 22, 2024
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Mar 22, 2024
Rollup merge of rust-lang#122845 - flip1995:clippy-subtree-update, r=matthiaskrgr

Clippy subtree update

r? ``@Manishearth``
@bors
Copy link
Contributor

bors commented Mar 22, 2024

⌛ Testing commit 8e53d53 with merge b57a10c...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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.