-
Notifications
You must be signed in to change notification settings - Fork 747
Add an option to set the default codegen style for all enums #1328
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great, thanks! Just a couple nits. Thanks for the tests too!
src/lib.rs
Outdated
codegen::EnumVariation::Consts => "consts", | ||
codegen::EnumVariation::ModuleConsts => "moduleconsts", | ||
}.into()) | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: No need for this semicolon.
src/codegen/mod.rs
Outdated
|
||
/// Create a `EnumVariation` from a string. | ||
fn from_str(s: &str) -> Result<Self, Self::Err> { | ||
match s.as_ref() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: no need for as_ref
I'm pretty sure.
src/lib.rs
Outdated
@@ -730,6 +741,12 @@ impl Builder { | |||
} | |||
|
|||
|
|||
/// Set the default type of code to generate for enums | |||
pub fn default_enum_variant(mut self, arg: codegen::EnumVariation) -> Builder { | |||
self.options.default_enum_variant = arg; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: Maybe call this default_enum_variation
? An enum variant is a totally different thing.
@bors-servo r+ Thanks! |
📌 Commit 393e779 has been approved by |
Add an option to set the default codegen style for all enums
☀️ Test successful - status-travis |
No description provided.