-
Notifications
You must be signed in to change notification settings - Fork 13k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of #85732 - Smittyvb:trait-alias-camelcase-lint, r=varkor
Lint against non-CamelCase trait alias names Type aliases are linted as such, so (unstable) trait aliases should be treated the same way.
- Loading branch information
Showing
3 changed files
with
19 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
// check-pass | ||
|
||
#![feature(trait_alias)] | ||
|
||
trait Foo = std::fmt::Display + std::fmt::Debug; | ||
trait bar = std::fmt::Display + std::fmt::Debug; //~WARN trait alias `bar` should have an upper camel case name | ||
|
||
fn main() {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
warning: trait alias `bar` should have an upper camel case name | ||
--> $DIR/style_lint.rs:6:7 | ||
| | ||
LL | trait bar = std::fmt::Display + std::fmt::Debug; | ||
| ^^^ help: convert the identifier to upper camel case: `Bar` | ||
| | ||
= note: `#[warn(non_camel_case_types)]` on by default | ||
|
||
warning: 1 warning emitted | ||
|