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

FN manual_range_patterns : negative values #11091

Closed
matthiaskrgr opened this issue Jul 3, 2023 · 0 comments · Fixed by #11096
Closed

FN manual_range_patterns : negative values #11091

matthiaskrgr opened this issue Jul 3, 2023 · 0 comments · Fixed by #11096
Labels
I-false-negative Issue: The lint should have been triggered on code, but wasn't

Comments

@matthiaskrgr
Copy link
Member

Description

fn main() {
    let x: i8 = i8::MAX;

    matches!(x, -1 | -2 | -3 | -4);

    let y = -3..5;
    let v = y.collect::<Vec<_>>();
    dbg!(v);
}

could warn as ranges can also go negative.

Version

rustc 1.72.0-nightly (5bd28f5ea 2023-06-28)
binary: rustc
commit-hash: 5bd28f5eac1ba3569bfa8d49ec3f5acbdfdff7a0
commit-date: 2023-06-28
host: x86_64-unknown-linux-gnu
release: 1.72.0-nightly
LLVM version: 16.0.5

Additional Labels

No response

@matthiaskrgr matthiaskrgr added the I-false-negative Issue: The lint should have been triggered on code, but wasn't label Jul 3, 2023
@bors bors closed this as completed in 9058b04 Jul 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
I-false-negative Issue: The lint should have been triggered on code, but wasn't
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant