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

new lint: manual_range_patterns #10968

Merged
merged 2 commits into from
Jun 27, 2023
Merged

new lint: manual_range_patterns #10968

merged 2 commits into from
Jun 27, 2023

Conversation

y21
Copy link
Member

@y21 y21 commented Jun 16, 2023

Fixes #4931

changelog: new lint: [manual_range_patterns]

@rustbot
Copy link
Collaborator

rustbot commented Jun 16, 2023

r? @Manishearth

(rustbot has picked a reviewer for you, use r? to override)

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties label Jun 16, 2023
@matthiaskrgr
Copy link
Member

matthiaskrgr commented Jun 17, 2023

We could probably also lint overlapping ranges, but its probably out of scope :D

pub fn main() {
    let x: u8 = 3;

    let b = matches!(x, 0..=1 | 0..=2 | 0..=3);
}

@y21
Copy link
Member Author

y21 commented Jun 17, 2023

Good idea, this now also lints (overlapping) ranges

@bors
Copy link
Contributor

bors commented Jun 19, 2023

☔ The latest upstream changes (presumably #10951) made this pull request unmergeable. Please resolve the merge conflicts.

@Manishearth
Copy link
Member

Bouncing review to @Centri3

Copy link
Member

@Centri3 Centri3 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good overall, thanks! Just two minor nits from me :D

clippy_lints/src/manual_range_pattern.rs Outdated Show resolved Hide resolved
clippy_lints/src/manual_range_pattern.rs Outdated Show resolved Hide resolved
@y21
Copy link
Member Author

y21 commented Jun 20, 2023

Oh this lint should probably be renamed to manual_range_patterns (note the s)

@y21 y21 changed the title new lint: manual_range_pattern new lint: manual_range_patterns Jun 20, 2023
@Manishearth
Copy link
Member

@bors delegate=centri3

@bors
Copy link
Contributor

bors commented Jun 20, 2023

✌️ @Centri3, you can now approve this pull request!

If @Manishearth told you to "r=me" after making some further change, please make that change, then do @bors r=@Manishearth

@bors
Copy link
Contributor

bors commented Jun 27, 2023

☔ The latest upstream changes (presumably #10884) made this pull request unmergeable. Please resolve the merge conflicts.

Copy link
Member

@Centri3 Centri3 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good, thank you! @Manishearth

@Centri3
Copy link
Member

Centri3 commented Jun 27, 2023

oh I forgot I could approve this one already 😅 I really hope I didn't miss something :)

@bors r+

@bors
Copy link
Contributor

bors commented Jun 27, 2023

📌 Commit b592d39 has been approved by Centri3

It is now in the queue for this repository.

@bors
Copy link
Contributor

bors commented Jun 27, 2023

⌛ Testing commit b592d39 with merge 9e57657...

@bors
Copy link
Contributor

bors commented Jun 27, 2023

☀️ Test successful - checks-action_dev_test, checks-action_remark_test, checks-action_test
Approved by: Centri3
Pushing 9e57657 to master...

@bors bors merged commit 9e57657 into rust-lang:master Jun 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-review Status: Awaiting review from the assignee but also interested parties
Projects
None yet
Development

Successfully merging this pull request may close these issues.

New Lint: Explicit ranges with p0 | ... | p_n => range pat
7 participants