-
Notifications
You must be signed in to change notification settings - Fork 182
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
Add LanguageIdentifier::cmp_bytes #1704
Conversation
Although it wasn't the goal of this PR, if you like what I do here, I could replace other impls like |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm with nit fixed
I tried it for I could simplify This means I'm adding code without deleting code, which isn't great, but this function has a specific purpose and use case. |
} else { | ||
return None; | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
optional, n-b
:
return self.langid.variants.get(i).map(||);
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The main thing to be done inside the map closure would be to update the state variant. I think I prefer using a more procedural code style in this function since it is a nontrivial function and involves mutable state.
Part of #831
I opened #1703 to think about how to scale this to
Locale
.