Skip to content

Commit

Permalink
Make rustfmt happy
Browse files Browse the repository at this point in the history
  • Loading branch information
auscompgeek authored and emilio committed Nov 14, 2019
1 parent ac49847 commit 5f4dc4f
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 17 deletions.
20 changes: 14 additions & 6 deletions src/codegen/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2323,16 +2323,24 @@ impl std::str::FromStr for EnumVariation {
/// Create a `EnumVariation` from a string.
fn from_str(s: &str) -> Result<Self, Self::Err> {
match s {
"rust" => Ok(EnumVariation::Rust{ non_exhaustive: false }),
"rust_non_exhaustive" => Ok(EnumVariation::Rust{ non_exhaustive: true }),
"rust" => Ok(EnumVariation::Rust {
non_exhaustive: false,
}),
"rust_non_exhaustive" => Ok(EnumVariation::Rust {
non_exhaustive: true,
}),
"bitfield" => Ok(EnumVariation::NewType { is_bitfield: true }),
"consts" => Ok(EnumVariation::Consts),
"moduleconsts" => Ok(EnumVariation::ModuleConsts),
"newtype" => Ok(EnumVariation::NewType { is_bitfield: false }),
_ => Err(std::io::Error::new(std::io::ErrorKind::InvalidInput,
concat!("Got an invalid EnumVariation. Accepted values ",
"are 'rust', 'rust_non_exhaustive', 'bitfield', 'consts',",
"'moduleconsts', and 'newtype'."))),
_ => Err(std::io::Error::new(
std::io::ErrorKind::InvalidInput,
concat!(
"Got an invalid EnumVariation. Accepted values ",
"are 'rust', 'rust_non_exhaustive', 'bitfield', 'consts',",
"'moduleconsts', and 'newtype'."
),
)),
}
}
}
Expand Down
7 changes: 2 additions & 5 deletions src/ir/enum_ty.rs
Original file line number Diff line number Diff line change
Expand Up @@ -184,11 +184,8 @@ impl Enum {
item,
) {
EnumVariation::NewType { is_bitfield: true }
} else if self.is_matching_enum(
ctx,
&ctx.options().newtype_enums,
item,
) {
} else if self.is_matching_enum(ctx, &ctx.options().newtype_enums, item)
{
EnumVariation::NewType { is_bitfield: false }
} else if self.is_matching_enum(
ctx,
Expand Down
12 changes: 6 additions & 6 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -236,12 +236,12 @@ impl Builder {
codegen::EnumVariation::Rust {
non_exhaustive: true,
} => "rust_non_exhaustive",
codegen::EnumVariation::NewType {
is_bitfield: true,
} => "bitfield",
codegen::EnumVariation::NewType {
is_bitfield: false,
} => "newtype",
codegen::EnumVariation::NewType { is_bitfield: true } => {
"bitfield"
}
codegen::EnumVariation::NewType { is_bitfield: false } => {
"newtype"
}
codegen::EnumVariation::Consts => "consts",
codegen::EnumVariation::ModuleConsts => "moduleconsts",
}
Expand Down

0 comments on commit 5f4dc4f

Please sign in to comment.