-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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 #4087 - phansch:move_tests, r=matthiaskrgr
- Loading branch information
Showing
4 changed files
with
126 additions
and
121 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
#[warn(clippy::many_single_char_names)] | ||
|
||
fn bla() { | ||
let a: i32; | ||
let (b, c, d): (i32, i64, i16); | ||
{ | ||
{ | ||
let cdefg: i32; | ||
let blar: i32; | ||
} | ||
{ | ||
let e: i32; | ||
} | ||
{ | ||
let e: i32; | ||
let f: i32; | ||
} | ||
match 5 { | ||
1 => println!(), | ||
e => panic!(), | ||
} | ||
match 5 { | ||
1 => println!(), | ||
_ => panic!(), | ||
} | ||
} | ||
} | ||
|
||
fn bindings(a: i32, b: i32, c: i32, d: i32, e: i32, f: i32, g: i32, h: i32) {} | ||
|
||
fn bindings2() { | ||
let (a, b, c, d, e, f, g, h) = unimplemented!(); | ||
} | ||
|
||
fn shadowing() { | ||
let a = 0i32; | ||
let a = 0i32; | ||
let a = 0i32; | ||
let a = 0i32; | ||
let a = 0i32; | ||
let a = 0i32; | ||
{ | ||
let a = 0i32; | ||
} | ||
} | ||
|
||
fn patterns() { | ||
enum Z { | ||
A(i32), | ||
B(i32), | ||
C(i32), | ||
D(i32), | ||
E(i32), | ||
F(i32), | ||
} | ||
|
||
// These should not trigger a warning, since the pattern bindings are a new scope. | ||
match Z::A(0) { | ||
Z::A(a) => {}, | ||
Z::B(b) => {}, | ||
Z::C(c) => {}, | ||
Z::D(d) => {}, | ||
Z::E(e) => {}, | ||
Z::F(f) => {}, | ||
} | ||
} | ||
|
||
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,51 @@ | ||
error: 5 bindings with single-character names in scope | ||
--> $DIR/many_single_char_names.rs:4:9 | ||
| | ||
LL | let a: i32; | ||
| ^ | ||
LL | let (b, c, d): (i32, i64, i16); | ||
| ^ ^ ^ | ||
... | ||
LL | let e: i32; | ||
| ^ | ||
| | ||
= note: `-D clippy::many-single-char-names` implied by `-D warnings` | ||
|
||
error: 6 bindings with single-character names in scope | ||
--> $DIR/many_single_char_names.rs:4:9 | ||
| | ||
LL | let a: i32; | ||
| ^ | ||
LL | let (b, c, d): (i32, i64, i16); | ||
| ^ ^ ^ | ||
... | ||
LL | let e: i32; | ||
| ^ | ||
LL | let f: i32; | ||
| ^ | ||
|
||
error: 5 bindings with single-character names in scope | ||
--> $DIR/many_single_char_names.rs:4:9 | ||
| | ||
LL | let a: i32; | ||
| ^ | ||
LL | let (b, c, d): (i32, i64, i16); | ||
| ^ ^ ^ | ||
... | ||
LL | e => panic!(), | ||
| ^ | ||
|
||
error: 8 bindings with single-character names in scope | ||
--> $DIR/many_single_char_names.rs:29:13 | ||
| | ||
LL | fn bindings(a: i32, b: i32, c: i32, d: i32, e: i32, f: i32, g: i32, h: i32) {} | ||
| ^ ^ ^ ^ ^ ^ ^ ^ | ||
|
||
error: 8 bindings with single-character names in scope | ||
--> $DIR/many_single_char_names.rs:32:10 | ||
| | ||
LL | let (a, b, c, d, e, f, g, h) = unimplemented!(); | ||
| ^ ^ ^ ^ ^ ^ ^ ^ | ||
|
||
error: aborting due to 5 previous errors | ||
|
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 |
---|---|---|
@@ -1,89 +1,40 @@ | ||
error: 5 bindings with single-character names in scope | ||
--> $DIR/non_expressive_names.rs:27:9 | ||
| | ||
LL | let a: i32; | ||
| ^ | ||
LL | let (b, c, d): (i32, i64, i16); | ||
| ^ ^ ^ | ||
... | ||
LL | let e: i32; | ||
| ^ | ||
| | ||
= note: `-D clippy::many-single-char-names` implied by `-D warnings` | ||
|
||
error: 6 bindings with single-character names in scope | ||
--> $DIR/non_expressive_names.rs:27:9 | ||
| | ||
LL | let a: i32; | ||
| ^ | ||
LL | let (b, c, d): (i32, i64, i16); | ||
| ^ ^ ^ | ||
... | ||
LL | let e: i32; | ||
| ^ | ||
LL | let f: i32; | ||
| ^ | ||
|
||
error: 5 bindings with single-character names in scope | ||
--> $DIR/non_expressive_names.rs:27:9 | ||
| | ||
LL | let a: i32; | ||
| ^ | ||
LL | let (b, c, d): (i32, i64, i16); | ||
| ^ ^ ^ | ||
... | ||
LL | e => panic!(), | ||
| ^ | ||
|
||
error: 8 bindings with single-character names in scope | ||
--> $DIR/non_expressive_names.rs:52:13 | ||
| | ||
LL | fn bindings(a: i32, b: i32, c: i32, d: i32, e: i32, f: i32, g: i32, h: i32) {} | ||
| ^ ^ ^ ^ ^ ^ ^ ^ | ||
|
||
error: 8 bindings with single-character names in scope | ||
--> $DIR/non_expressive_names.rs:55:10 | ||
| | ||
LL | let (a, b, c, d, e, f, g, h) = unimplemented!(); | ||
| ^ ^ ^ ^ ^ ^ ^ ^ | ||
|
||
error: consider choosing a more descriptive name | ||
--> $DIR/non_expressive_names.rs:92:9 | ||
--> $DIR/non_expressive_names.rs:27:9 | ||
| | ||
LL | let _1 = 1; //~ERROR Consider a more descriptive name | ||
| ^^ | ||
| | ||
= note: `-D clippy::just-underscores-and-digits` implied by `-D warnings` | ||
|
||
error: consider choosing a more descriptive name | ||
--> $DIR/non_expressive_names.rs:93:9 | ||
--> $DIR/non_expressive_names.rs:28:9 | ||
| | ||
LL | let ____1 = 1; //~ERROR Consider a more descriptive name | ||
| ^^^^^ | ||
|
||
error: consider choosing a more descriptive name | ||
--> $DIR/non_expressive_names.rs:94:9 | ||
--> $DIR/non_expressive_names.rs:29:9 | ||
| | ||
LL | let __1___2 = 12; //~ERROR Consider a more descriptive name | ||
| ^^^^^^^ | ||
|
||
error: consider choosing a more descriptive name | ||
--> $DIR/non_expressive_names.rs:114:13 | ||
--> $DIR/non_expressive_names.rs:49:13 | ||
| | ||
LL | let _1 = 1; | ||
| ^^ | ||
|
||
error: consider choosing a more descriptive name | ||
--> $DIR/non_expressive_names.rs:115:13 | ||
--> $DIR/non_expressive_names.rs:50:13 | ||
| | ||
LL | let ____1 = 1; | ||
| ^^^^^ | ||
|
||
error: consider choosing a more descriptive name | ||
--> $DIR/non_expressive_names.rs:116:13 | ||
--> $DIR/non_expressive_names.rs:51:13 | ||
| | ||
LL | let __1___2 = 12; | ||
| ^^^^^^^ | ||
|
||
error: aborting due to 11 previous errors | ||
error: aborting due to 6 previous errors | ||
|