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

Replace unwrap_u8 with into #528

Merged
merged 3 commits into from May 31, 2023
Merged

Replace unwrap_u8 with into #528

merged 3 commits into from May 31, 2023

Conversation

tarcieri
Copy link
Contributor

Leverages the From<Choice> impl for bool where applicable instead, which results in clearer logic which more closely matches bool.

@tarcieri tarcieri changed the title Remove uses of unwrap_u8 Replace unwrap_u8 with into May 29, 2023
Leverages the `From<Choice>` impl for `bool` where applicable instead,
which results in clearer logic which more closely matches `bool`.
src/ristretto.rs Outdated
|| t.is_negative().unwrap_u8() == 1u8
|| y.is_zero().unwrap_u8() == 1u8
{
if (!ok).into() || t.is_negative().into() || y.is_zero().into() {
Copy link
Contributor

Choose a reason for hiding this comment

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

Probably not an issue, but might be better to phrase this as:

if bool::from(!ok | t.is_negative() | y.is_zero()) {

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Pushed up a slightly different version in 32893c3

@rozbb rozbb merged commit 618c508 into main May 31, 2023
28 checks passed
@tarcieri tarcieri deleted the remove-unwrap_u8 branch May 31, 2023 02:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants