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

lint for matches with a single case #12447

Closed
thestinger opened this issue Feb 21, 2014 · 3 comments
Closed

lint for matches with a single case #12447

thestinger opened this issue Feb 21, 2014 · 3 comments
Labels
A-lints Area: Lints (warnings about flaws in source code) such as unused_mut.

Comments

@thestinger
Copy link
Contributor

Some of these are still around from when let patterns were totally broken. It'd also be nice from a pedagogical perspective.

@alexcrichton
Copy link
Member

This may be a little difficult because match is still semantically a little different than let. I've found a number of match statements that can become let, but for example all the new formatting code uses a single-case match instead of a let for lifetime reasons.

@steveklabnik
Copy link
Member

Traige: this lint still does not exist.

@steveklabnik
Copy link
Member

Since new lints have a big impact on users of rustc, the policy is that they should go through the RFC process like other user-facing changes. As such, I'm going to give this one a close, but if anyone comes across this ticket and wants this lint, consider adding it to clippy and/or writing up an RFC. Thanks!

matthiaskrgr pushed a commit to matthiaskrgr/rust that referenced this issue Mar 21, 2024
…r=y21

Fix rust-lang#12438 std_instead_of_core regression

Fixes rust-lang#12438.

Boy-scouting removed two paths that checks for duplication since I thought they were unused. However, that's just because I didn't spot it in the diff.

I installed [difftastic](https://github.com/Wilfred/difftastic) and ran it on the old one:

![image](https://github.com/rust-lang/rust-clippy/assets/34198073/5c51276c-055a-49a3-9425-6f7da0590fb0)

And the new one (fixed):

![image](https://github.com/rust-lang/rust-clippy/assets/34198073/6e10f29c-6d6b-4f64-893f-de526424f1cd)

New one (stderr):
![image](https://github.com/rust-lang/rust-clippy/assets/34198073/c4c07776-ee0f-47ba-996f-6b632de47c81)

Good teachings for the future when inspecting diffs with a lot of line changes, should've thought of that before, sorry for the trouble!

changelog: [`std_instead_of_core`] Fix false positive for crates that are in `std` but not `core`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-lints Area: Lints (warnings about flaws in source code) such as unused_mut.
Projects
None yet
Development

No branches or pull requests

3 participants