summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJ. Cliff Dyer <cdyer@edx.org>2016-11-06 16:51:25 -0500
committerJ. Cliff Dyer <cdyer@edx.org>2016-11-06 16:51:25 -0500
commitfda05481d98a86254168a850d8be4d23a9c7c51a (patch)
treec857a0e2e428465828899bc1b58632eaae5fe506
parent15d1881e071278cc65acd202284943a6f5ce4543 (diff)
Restore outer conditional.
-rw-r--r--src/ir/enum_ty.rs21
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))
}
}