Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Previously, to_fields and to_fields_le used unsafe to convert a &[u8] into a &[u8; 8]. Now that we're only supporting Rust versions where TryInto is stable, we can use try_into().unwrap() instead, making uuid entirely safe Rust. In release mode, the compiler detects that the slice will always be the correct size, so try_into can never fail. Thus, the unwrap is optimized out and we end up with the exact same assembly as the unsafe block. Godbolt output showing the resulting assembly: https://godbolt.org/z/nWxT6W Closes #488.
- Loading branch information