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

ignored-unit-patterns ignores mutability #11754

Open
matthiaskrgr opened this issue Nov 3, 2023 · 0 comments
Open

ignored-unit-patterns ignores mutability #11754

matthiaskrgr opened this issue Nov 3, 2023 · 0 comments
Labels
C-bug Category: Clippy is not doing the correct thing I-false-positive Issue: The lint was triggered on code it shouldn't have

Comments

@matthiaskrgr
Copy link
Member

Summary

.

Lint Name

ignored-unit-patterns

Reproducer

I tried this code:

// edition:2021
// check-pass
#![feature(coroutines)]

fn main() {
    let x = &mut ();
    || {
        let _c = || yield *&mut *x;
        || _ = &mut *x;
    };
}

I saw this happen:

warning: matching over `()` is more explicit
 --> issue-110929-coroutine-conflict-error-ice.rs:9:12
  |
9 |         || _ = &mut *x;
  |            ^ help: use `()` instead of `_`: `()`
  |
  = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#ignored_unit_patterns
  = note: requested on the command line with `-W clippy::ignored-unit-patterns`

Applying the suggestion breaks the code.

Version

rustc 1.75.0-nightly (9c20ddd95 2023-11-03)
binary: rustc
commit-hash: 9c20ddd956426d577d77cb3f57a7db2227a3c6e9
commit-date: 2023-11-03
host: x86_64-unknown-linux-gnu
release: 1.75.0-nightly
LLVM version: 17.0.4

Additional Labels

No response

@matthiaskrgr matthiaskrgr added C-bug Category: Clippy is not doing the correct thing I-false-positive Issue: The lint was triggered on code it shouldn't have labels Nov 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: Clippy is not doing the correct thing I-false-positive Issue: The lint was triggered on code it shouldn't have
Projects
None yet
Development

No branches or pull requests

1 participant