Skip to content

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

Merged
merged 3 commits into from
Jun 4, 2018

Conversation

db48x
Copy link
Contributor

@db48x db48x commented Jun 3, 2018

No description provided.

Copy link
Contributor

@emilio emilio left a 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())
};
Copy link
Contributor

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.


/// Create a `EnumVariation` from a string.
fn from_str(s: &str) -> Result<Self, Self::Err> {
match s.as_ref() {
Copy link
Contributor

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;
Copy link
Contributor

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.

@emilio
Copy link
Contributor

emilio commented Jun 4, 2018

@bors-servo r+

Thanks!

@bors-servo
Copy link

📌 Commit 393e779 has been approved by emilio

@bors-servo
Copy link

⌛ Testing commit 393e779 with merge 4403741...

bors-servo pushed a commit that referenced this pull request Jun 4, 2018
Add an option to set the default codegen style for all enums
@bors-servo
Copy link

☀️ Test successful - status-travis
Approved by: emilio
Pushing 4403741 to master...

@bors-servo bors-servo merged commit 393e779 into rust-lang:master Jun 4, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants