Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upUnify non-snake-case lints and non-uppercase statics lints; add lint groups #15773
Conversation
This comment has been minimized.
This comment has been minimized.
|
I'm a little uneasy about the continued proliferation of micro-lints, especially for various style criteria. I think I would rather push lints like these all under the same "non snake case" lint rather than a "non snake case X" lint. |
This comment has been minimized.
This comment has been minimized.
|
I agree—the level of control over style lints right now is far too fine-grained. Do you think it would be a good idea to unify some other lints (like (It should be noted that right now |
P1start
changed the title
Add lints for non-snake-case lifetime parameters and module names
Unify non-snake-case lints and non-uppercase statics lints
Jul 19, 2014
This comment has been minimized.
This comment has been minimized.
|
OK, I’ve merged the uppercase and snake case lints together. I’m not sure if this counts as a breaking change or not. |
This comment has been minimized.
This comment has been minimized.
|
Thanks @P1start! I do think that this needs a cc @brson, @aturon, I like the direction this is going, I'm not sure if we want to go all the way towards just one |
This comment has been minimized.
This comment has been minimized.
Maybe we could have umbrella lints? So one still have fine-grained control of individual things, but the 'common' cases are covered by lints like |
This comment has been minimized.
This comment has been minimized.
|
@huonw Maybe that could be done with a normal attribute that expands to a number of lint attributes? So something like |
This comment has been minimized.
This comment has been minimized.
|
I don't like it; it's a whole new attribute to remember and use, and isn't very extensible, e.g. what if one wants |
This comment has been minimized.
This comment has been minimized.
|
Perhaps the most flexible solution would be to allow lints to have parameters. All the style lints could be put into one lint, with parameters for fine-tuning. So |
This comment has been minimized.
This comment has been minimized.
|
Yes @huonw I think that may be a good direction to start going in. Messaging that in terms of error messages may get tricky, but I think it may be good to have. |
This comment has been minimized.
This comment has been minimized.
|
Should I add umbrella lints ( |
This comment has been minimized.
This comment has been minimized.
|
Well, I’ve added lint groups/umbrella lints. I’ve also added two built-in lint groups named |
P1start
changed the title
Unify non-snake-case lints and non-uppercase statics lints
Unify non-snake-case lints and non-uppercase statics lints; add lint groups
Jul 21, 2014
This comment has been minimized.
This comment has been minimized.
|
@P1start this looks pretty good to me, I'd like to gain a few more opinions about umbrella lints, however, because this is a pretty big feature for the compiler. |
This comment has been minimized.
This comment has been minimized.
|
My 2c: I think umbrella lints are a very useful idea, and I don't see a lot of downside. So +1 from me! |
This comment has been minimized.
This comment has been minimized.
|
Not quite +1: see http://discuss.rust-lang.org/t/umbrella-lints/307 (TLDR -- I am concerned about backwards compat) |
This comment has been minimized.
This comment has been minimized.
|
This was discussed in yesterday's meeting and we decided to merge it, thanks for being patient @P1start! |
bors
added a commit
that referenced
this pull request
Aug 6, 2014
This comment has been minimized.
This comment has been minimized.
|
Updated; tests pass locally. I should probably also note that this change makes |
P1start
force-pushed the
P1start:style-lints
branch
2 times, most recently
from
677333f
to
7282c4d
Aug 26, 2014
This comment has been minimized.
This comment has been minimized.
|
Argh sorry @P1start, this totally fell under the radar! Feel free to ping PRs if they don't seem to have much activity to spur us into action! |
bors
added a commit
that referenced
this pull request
Aug 29, 2014
P1start
force-pushed the
P1start:style-lints
branch
from
7282c4d
to
4b7077f
Aug 29, 2014
P1start
added some commits
Jul 18, 2014
P1start
force-pushed the
P1start:style-lints
branch
from
4b7077f
to
ed2aad8
Aug 29, 2014
This comment has been minimized.
This comment has been minimized.
|
Updated again; tests pass locally. |
This comment has been minimized.
This comment has been minimized.
alexcrichton
commented on ed2aad8
Aug 29, 2014
|
r+ |
This comment has been minimized.
This comment has been minimized.
|
saw approval from alexcrichton |
This comment has been minimized.
This comment has been minimized.
|
merging P1start/rust/style-lints = ed2aad8 into auto |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
fast-forwarding master to auto = 5419b2c |
bors
added a commit
that referenced
this pull request
Aug 29, 2014
bors
closed this
Aug 30, 2014
bors
merged commit ed2aad8
into
rust-lang:master
Aug 30, 2014
1 of 2 checks passed
retep998
added a commit
to retep998/rust
that referenced
this pull request
Aug 30, 2014
retep998
added a commit
to retep998/rust
that referenced
this pull request
Aug 31, 2014
This comment has been minimized.
This comment has been minimized.
|
cc #16880 |
P1start commentedJul 18, 2014
This unifies the
non_snake_case_functionsanduppercase_variableslints into one lint,non_snake_case. It also now checks for non-snake-case modules. This also extends the non-camel-case types lint to check type parameters, and merges thenon_uppercase_pattern_staticslint into thenon_uppercase_staticslint.Because the
uppercase_variableslint is now part of thenon_snake_caselint, all non-snake-case variables that start with lowercase characters (such asfooBar) will now trigger thenon_snake_caselint.New code should be updated to use the new
non_snake_caselint instead of the previousnon_snake_case_functionsanduppercase_variableslints. All use of thenon_uppercase_pattern_staticsshould be replaced with thenon_uppercase_staticslint. Any code that previously contained non-snake-case module or variable names should be updated to use snake case names or disable thenon_snake_caselint. Any code with non-camel-case type parameters should be changed to use camel case or disable thenon_camel_case_typeslint.This also adds support for lint groups to the compiler. Lint groups are a way of grouping a number of lints together under one name. For example, this also defines a default lint for naming conventions, named
bad_style. Writing#[allow(bad_style)]is equivalent to writing#[allow(non_camel_case_types, non_snake_case, non_uppercase_statics)]. These lint groups can also be defined as a compiler plugin using the newRegistry::register_lint_groupmethod.This also adds two built-in lint groups,
bad_styleandunused. The contents of these groups can be seen by runningrustc -W help.[breaking-change]