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

False Positive from match_str_case_mismatch #7882

Closed
MinerSebas opened this issue Oct 25, 2021 · 1 comment
Closed

False Positive from match_str_case_mismatch #7882

MinerSebas opened this issue Oct 25, 2021 · 1 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

Comments

@MinerSebas
Copy link

Lint name: match_str_case_mismatch

I tried this code:

	match "DX12".to_lowercase().as_str() {
        "dx12" => (),
        _ => (),
    }

I expected to see this happen: The Lint doesn't Trigger.

Instead, this happened: The Lint triggered:

error: this `match` arm has a differing case than its expression
 --> src\main.rs:3:9
  |
3 |         "dx12" => (),
  |         ^^^^^^
  |
  = note: `#[deny(clippy::match_str_case_mismatch)]` on by default
  = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#match_str_case_mismatch
help: consider changing the case of this arm to respect `to_lower_case`
  |
3 |         "dx12" => (),
  |         ~~~~~~

Meta

Rust version (rustc -Vv):

rustc 1.58.0-nightly (00d5e42e7 2021-10-24)
binary: rustc
commit-hash: 00d5e42e776da900049fe19087bc9b0057ec70cd
commit-date: 2021-10-24
host: x86_64-pc-windows-msvc
release: 1.58.0-nightly
LLVM version: 13.0.0
@MinerSebas MinerSebas 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 Oct 25, 2021
@xFrednet
Copy link
Member

Thanks for the report. This FP should be fixed by #7865 🙃

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

2 participants