Skip to content

Commit 51cc552

Browse files
committed
fix, changelog
1 parent 8afe057 commit 51cc552

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
1313

1414
### Changed
1515

16+
- Enum items now associated with values (C-style), enums annotated with `repr(fty)`
1617
- Bump `svd-parser` dependency (0.8.1)
1718

1819
## [v0.16.1] - 2019-08-17

src/generate/register.rs

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -636,13 +636,11 @@ impl Variant {
636636
fn add_from_variants(mod_items: &mut Vec<TokenStream>, variants: &Vec<Variant>, pc: &Ident, f: &F, desc: &str, reset_value: Option<u64>) {
637637
let fty = &f.ty;
638638

639-
let mut repr = quote! { #[repr(#fty)] };
640-
let mut cast = quote! { variant as _ };
641-
642-
if f.ty == "bool" {
643-
repr = quote! { };
644-
cast = quote! { variant as u8 != 0 };
645-
}
639+
let (repr, cast) = if f.ty == "bool" {
640+
(quote! { }, quote! { variant as u8 != 0 })
641+
} else {
642+
(quote! { #[repr(#fty)] }, quote! { variant as _ })
643+
};
646644

647645
let vars = variants
648646
.iter()

0 commit comments

Comments
 (0)