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

Allow Numbers After Underscore in Camel Case Types #12986

Closed
bvssvni opened this issue Mar 18, 2014 · 1 comment
Closed

Allow Numbers After Underscore in Camel Case Types #12986

bvssvni opened this issue Mar 18, 2014 · 1 comment

Comments

@bvssvni
Copy link

bvssvni commented Mar 18, 2014

I get this lint on names like:

SVGVersion_1_1

Suggests allowing numbers after underscore by replacing

!ident.contains_char('_')

with

!contains_invalid_after_underscore(ident)

This function to be put within 'is_camel_case':

        // Allow trailing underscore or numeric after underscore.
        fn contains_invalid_after_underscore(ident: &str) -> bool {
            let mut last_was_underscore = false;
            for c in ident.chars() {
                if last_was_underscore && !"_0123456789".contains_char(c) {
                    return true;
                }
                last_was_underscore = c == '_';
            }
            false
        }

Edit: changed to better version suggested by huonw.

@bvssvni
Copy link
Author

bvssvni commented Mar 26, 2014

I did some searching and could not find any precedence for this. The tools that convert from underscore to camel case either removes numbers or merges them together, which means there is no conventions to write multiple numbers in this style. It is easier to add those exceptions later than removing them.

I talked to somebody on the rust-internals IRC channel. One was ok with it (if precedence) and one was against. Nobody was strongly in favor of it, neither am I.

Closing.

@bvssvni bvssvni closed this as completed Mar 26, 2014
lnicola pushed a commit to lnicola/rust that referenced this issue Aug 16, 2022
Fix pattern field completions not working for unions
flip1995 pushed a commit to flip1995/rust that referenced this issue Jun 27, 2024
…1995

Cache lintcheck binary in ci

Always trims ~40s off the `diff` job as it no longer needs to install the rust toolchain or compile lintcheck. Saves a further ~20s for the `base`/`head` jobs when the cache is warm

It now uses artifacts for restoring the JSON between jobs as per rust-lang/rust-clippy#10398 (comment), cc `@flip1995`

The lintcheck changes are to make `./target/debug/lintcheck` work, running `cargo-clippy`/`clippy-driver` directly doesn't work without `LD_LIBRARY_PATH`/etc being set which is currently being done by `cargo run`. By merging the `--recursive` and normal cases to both go via regular `cargo check` we can have Cargo set up the environment for us

r? `@xFrednet`

changelog: none
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 a pull request may close this issue.

1 participant