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:
1 parent
517638a38f
commit
07e8501ad6
1 file changed
+3
-2
+3
-2
@@ -34,8 +34,9 @@ macro_rules! tags {
|
|||||||
impl $name {
|
impl $name {
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
fn __from_inner_type(n: $ty) -> Result<Self, $ty> {
|
fn __from_inner_type(n: $ty) -> Result<Self, $ty> {
|
||||||
$(if n == $val { Ok($name::$tag) } else)* {
|
match n {
|
||||||
Err(n)
|
$( $val => Ok($name::$tag), )*
|
||||||
|
n => Err(n),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user