Skip to content

Commit fda0548

Browse files
author
J. Cliff Dyer
committed
Restore outer conditional.
1 parent 15d1881 commit fda0548

File tree

1 file changed

+9
-12
lines changed

1 file changed

+9
-12
lines changed

src/ir/enum_ty.rs

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -71,23 +71,20 @@ impl Enum {
7171
};
7272

7373
declaration.visit(|cursor| {
74-
let val = if is_signed {
75-
cursor.enum_val_signed().map(EnumVariantValue::Signed)
76-
} else {
77-
if cursor.kind() == CXCursor_EnumConstantDecl {
78-
Some(EnumVariantValue::Unsigned(cursor.enum_val_unsigned()))
74+
if cursor.kind() == CXCursor_EnumConstantDecl {
75+
let value = if is_signed {
76+
cursor.enum_val_signed().map(EnumVariantValue::Signed)
7977
} else {
80-
None
78+
Some(EnumVariantValue::Unsigned(cursor.enum_val_unsigned()))
79+
};
80+
if let Some(val) = value {
81+
let name = cursor.spelling();
82+
let comment = cursor.raw_comment();
83+
variants.push(EnumVariant::new(name, comment, val));
8184
}
82-
};
83-
if let Some(val) = val {
84-
let name = cursor.spelling();
85-
let comment = cursor.raw_comment();
86-
variants.push(EnumVariant::new(name, comment, val));
8785
}
8886
CXChildVisit_Continue
8987
});
90-
9188
Ok(Enum::new(repr, variants))
9289
}
9390
}

0 commit comments

Comments
 (0)