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

match bool removes braces breaking code #14099

Open
matthiaskrgr opened this issue Jan 29, 2025 · 0 comments · May be fixed by #14102
Open

match bool removes braces breaking code #14099

matthiaskrgr opened this issue Jan 29, 2025 · 0 comments · May be fixed by #14102
Assignees
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 I-suggestion-causes-error Issue: The suggestions provided by this Lint cause an ICE/error when applied

Comments

@matthiaskrgr
Copy link
Member

Summary

.

Lint Name

match-bool

Reproducer

I tried this code:

fn main() {
    match true {
        true => 'a: {
            break 'a;
        }
        _ => (),
    }
}

I saw this happen:
suggested code is

      if true 'a: {
          break 'a;
      }
  

I expected to see this happen:

    if true {
        'a: {
            break 'a;
        }
    }

Version

rustc 1.86.0-nightly (ccc9ba5c3 2025-01-29)
binary: rustc
commit-hash: ccc9ba5c30c675824e9ca62b960830ff4a1858ea
commit-date: 2025-01-29
host: x86_64-unknown-linux-gnu
release: 1.86.0-nightly
LLVM version: 19.1.7

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 I-suggestion-causes-error Issue: The suggestions provided by this Lint cause an ICE/error when applied labels Jan 29, 2025
@samueltardieu samueltardieu self-assigned this Jan 29, 2025
@samueltardieu samueltardieu linked a pull request Jan 29, 2025 that will close this issue
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 I-suggestion-causes-error Issue: The suggestions provided by this Lint cause an ICE/error when applied
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants