traits icon indicating copy to clipboard operation
traits copied to clipboard

Use the API as intended by the subtle crate authors

Open sebastianv89 opened this issue 2 years ago • 1 comments

This is admittedly a very nit-picky change, but according to the Subtle documentation (https://docs.rs/subtle/latest/subtle/struct.Choice.html#note), a Choice should be converted to a bool using the From implementation. Specifically they added the following note to the unwrap_u8 documentation:

This function only exists as an escape hatch for the rare case where it’s not possible to use one of the subtle-provided trait impls. To convert a Choice to a bool, use the From implementation instead.

sebastianv89 avatar Aug 12 '22 09:08 sebastianv89

That functionality didn’t exist at the time this was written. We’ve slowly been migrating.

All that said, that isn’t the correct way to turbofish Into, and I think in such cases the compiler can infer the proper type.

tarcieri avatar Aug 12 '22 12:08 tarcieri

Fixed in #1088

newpavlov avatar Aug 22 '22 17:08 newpavlov