Skip to content

Use associated constants for rust enums when available #1355

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 1 commit into from
Jul 30, 2018

Conversation

Lytigas
Copy link
Contributor

@Lytigas Lytigas commented Jul 30, 2018

I decided to skip anonymous enums because the way they are exposed would make this a bigger job than I think this needs to be. Namely, they don't have a pretty-named rust enum. I'd be happy to look into it more if it's a desired feature.

With regards to test changes, there are several involving wrapping linter attributes. I upgraded to the latest nightly rustfmt today, so I think they should be correct.

Unrelated: I also noticed there's some weird behavior in the anon_enum_trait test. All the variants are set equal to generic_type.

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 good, thanks!

I'll merge as-is and land a few cleanups and a test for this with c++ namespaces as a followup.

Thanks so much!

);
// Use associated constants for named enums
if enum_ty.name().is_some() &&
ctx.options().rust_features().associated_const {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Indentation is a bit weird here.

@emilio emilio merged commit cb8bfea into rust-lang:master Jul 30, 2018
emilio added a commit that referenced this pull request Jul 30, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants