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

Avoid default (_) case in match #5640

Open
obycode opened this issue Jan 2, 2025 · 3 comments
Open

Avoid default (_) case in match #5640

obycode opened this issue Jan 2, 2025 · 3 comments

Comments

@obycode
Copy link
Contributor

obycode commented Jan 2, 2025

          I don't like this function, it should never use `_ => true` (it should explicitly handle all cases), because if we ever add to these enums it will still build and return incorrect values

Originally posted by @jbencin in #5630 (comment)

@jcnelson
Copy link
Member

jcnelson commented Jan 3, 2025

From sync call:

Let's see if there's a clippy lint to check for this, and add it to CI.

@jferrant
Copy link
Collaborator

jferrant commented Jan 3, 2025

From sync call:

Let's see if there's a clippy lint to check for this, and add it to CI.

I think its called wildcard_match_arm

@jbencin
Copy link
Contributor

jbencin commented Jan 3, 2025

I don't think using wildcard is always bad, just in this particular case _ => true fails in the wrong direction. It would return true for new/unknown states, where we would want to return false

It would be a huge task to apply this entire lint to entire repository, but maybe it should be applied to certain files, like auth.rs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Status: 🆕 New
Development

No branches or pull requests

4 participants