diff --git a/bindgen/codegen/mod.rs b/bindgen/codegen/mod.rs index 88dc57866b..382a8ed344 100644 --- a/bindgen/codegen/mod.rs +++ b/bindgen/codegen/mod.rs @@ -4107,9 +4107,10 @@ impl FromStr for AliasVariation { } /// Enum for how non-`Copy` `union`s should be translated. -#[derive(Copy, Clone, PartialEq, Eq, Debug)] +#[derive(Copy, Clone, PartialEq, Eq, Debug, Default)] pub enum NonCopyUnionStyle { /// Wrap members in a type generated by `bindgen`. + #[default] BindgenWrapper, /// Wrap members in [`::core::mem::ManuallyDrop`]. /// @@ -4129,12 +4130,6 @@ impl fmt::Display for NonCopyUnionStyle { } } -impl Default for NonCopyUnionStyle { - fn default() -> Self { - Self::BindgenWrapper - } -} - impl FromStr for NonCopyUnionStyle { type Err = std::io::Error; diff --git a/bindgen/lib.rs b/bindgen/lib.rs index f2c8870e05..644d9a68d9 100644 --- a/bindgen/lib.rs +++ b/bindgen/lib.rs @@ -167,24 +167,19 @@ impl Default for CodegenConfig { } /// Formatting tools that can be used to format the bindings -#[derive(Debug, Clone, Copy, PartialEq, Eq)] +#[derive(Debug, Clone, Copy, PartialEq, Eq, Default)] #[non_exhaustive] pub enum Formatter { /// Do not format the bindings. None, /// Use `rustfmt` to format the bindings. + #[default] Rustfmt, #[cfg(feature = "prettyplease")] /// Use `prettyplease` to format the bindings. Prettyplease, } -impl Default for Formatter { - fn default() -> Self { - Self::Rustfmt - } -} - impl FromStr for Formatter { type Err = String;