diff options
author | J. Cliff Dyer <cdyer@edx.org> | 2016-11-06 16:51:25 -0500 |
---|---|---|
committer | J. Cliff Dyer <cdyer@edx.org> | 2016-11-06 16:51:25 -0500 |
commit | fda05481d98a86254168a850d8be4d23a9c7c51a (patch) | |
tree | c857a0e2e428465828899bc1b58632eaae5fe506 | |
parent | 15d1881e071278cc65acd202284943a6f5ce4543 (diff) |
Restore outer conditional.
-rw-r--r-- | src/ir/enum_ty.rs | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/src/ir/enum_ty.rs b/src/ir/enum_ty.rs index fb7b2018..1bcd5b14 100644 --- a/src/ir/enum_ty.rs +++ b/src/ir/enum_ty.rs @@ -71,23 +71,20 @@ impl Enum { }; declaration.visit(|cursor| { - let val = if is_signed { - cursor.enum_val_signed().map(EnumVariantValue::Signed) - } else { - if cursor.kind() == CXCursor_EnumConstantDecl { - Some(EnumVariantValue::Unsigned(cursor.enum_val_unsigned())) + if cursor.kind() == CXCursor_EnumConstantDecl { + let value = if is_signed { + cursor.enum_val_signed().map(EnumVariantValue::Signed) } else { - None + Some(EnumVariantValue::Unsigned(cursor.enum_val_unsigned())) + }; + if let Some(val) = value { + let name = cursor.spelling(); + let comment = cursor.raw_comment(); + variants.push(EnumVariant::new(name, comment, val)); } - }; - if let Some(val) = val { - let name = cursor.spelling(); - let comment = cursor.raw_comment(); - variants.push(EnumVariant::new(name, comment, val)); } CXChildVisit_Continue }); - Ok(Enum::new(repr, variants)) } } |