Prefer matching over if-else-chain in tags macro

Thanks to the review comment for pointing this style issue out.
This commit is contained in:
Andreas Molzer committed 2019-11-12 10:53:38 +01:00
1 parent 517638a38f
commit 07e8501ad6
1 file changed
+3 -2
+3 -2
View File
@@ -34,8 +34,9 @@ macro_rules! tags {
impl $name {
#[inline(always)]
fn __from_inner_type(n: $ty) -> Result<Self, $ty> {
$(if n == $val { Ok($name::$tag) } else)* {
Err(n)
match n {
$( $val => Ok($name::$tag), )*
n => Err(n),
}
}