TryFrom on enums should use anyhow::Error as the error type

This commit is contained in:
Vicki Pfau 2024-08-13 22:30:23 -07:00
parent 3cd834b385
commit d465bc2750
4 changed files with 16 additions and 16 deletions

View file

@ -34,7 +34,7 @@ macro_rules! enum_roundtrip {
};
($enum:ident => $value:literal : $ty:ty = $variant:ident) => {
assert_eq!($enum::$variant as $ty, $value);
assert_eq!($enum::try_from($value), Ok($enum::$variant));
assert_eq!($enum::try_from($value).unwrap(), $enum::$variant);
};
($enum:ident { $($value:literal : $ty:ident = $variant:ident,)+ }) => {