Skip to content
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

Add underscore to enum and bitflags member starting with digits #642

Merged
merged 1 commit into from Oct 3, 2018

Conversation

Projects
None yet
4 participants
@EPashkin
Copy link
Member

EPashkin commented Oct 2, 2018

Fix #600

@ceyusa can you test it?

cc @GuillaumeGomez, @sdroege, @russel

@EPashkin EPashkin force-pushed the EPashkin:numeric_enum_members branch 2 times, most recently from b2345ba to 50a2c26 Oct 2, 2018

@@ -45,6 +44,22 @@ pub fn module_name(name: &str) -> String {
mangle_keywords(name.to_snake()).into_owned()
}

pub fn enum_member_name(name: &str) -> String {
if name.starts_with(|c: char| c.is_digit(10)) {

This comment has been minimized.

@sdroege

sdroege Oct 2, 2018

Member

Maybe make this the other way around? If it does not start with a letter

This comment has been minimized.

@EPashkin

EPashkin Oct 2, 2018

Author Member

You right

This comment has been minimized.

@EPashkin

EPashkin Oct 2, 2018

Author Member

Fixed

Show resolved Hide resolved src/nameutil.rs

@EPashkin EPashkin force-pushed the EPashkin:numeric_enum_members branch from 50a2c26 to c7fdd9f Oct 2, 2018

@ceyusa

This comment has been minimized.

Copy link
Contributor

ceyusa commented Oct 3, 2018

it works! or at least, it generates a compileable code :) thanks!

@sdroege

This comment has been minimized.

Copy link
Member

sdroege commented Oct 3, 2018

Let's go for that then :)

@GuillaumeGomez

This comment has been minimized.

Copy link
Member

GuillaumeGomez commented Oct 3, 2018

Let's go for it then!

@EPashkin EPashkin merged commit ffda6f9 into gtk-rs:master Oct 3, 2018

2 checks passed

continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details

@EPashkin EPashkin deleted the EPashkin:numeric_enum_members branch Oct 3, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.