convert some if-lets to match

This commit is contained in:
Aleksey Kladov 2019-01-08 14:23:00 +03:00
parent 96236a9be5
commit 50d5e37481

View file

@ -171,24 +171,21 @@ impl VariantData {
} }
} }
pub fn is_struct(&self) -> bool { pub fn is_struct(&self) -> bool {
if let VariantData::Struct(..) = *self { match self {
true VariantData::Struct(..) => true,
} else { _ => false,
false
} }
} }
pub fn is_tuple(&self) -> bool { pub fn is_tuple(&self) -> bool {
if let VariantData::Tuple(..) = *self { match self {
true VariantData::Tuple(..) => true,
} else { _ => false,
false
} }
} }
pub fn is_unit(&self) -> bool { pub fn is_unit(&self) -> bool {
if let VariantData::Unit = *self { match self {
true VariantData::Unit => true,
} else { _ => false,
false
} }
} }
} }