Skip to content

Commit

Permalink
Remove unnecessary unsafe blocks from FromPrimitive example (#42)
Browse files Browse the repository at this point in the history
Both `std::convert::From::from` and `num_enum::FromPrimitive::from_primitive` are safe to call.
  • Loading branch information
jonasmalacofilho committed May 7, 2021
1 parent 6b52ecd commit 380e108
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions README.md
Expand Up @@ -147,11 +147,11 @@ enum Number {
fn main() {
assert_eq!(
Number::Zero,
unsafe { Number::from(0_u8) },
Number::from(0_u8),
);
assert_eq!(
Number::NonZero,
unsafe { Number::from(1_u8) },
Number::from(1_u8),
);
}
```
Expand Down

0 comments on commit 380e108

Please sign in to comment.