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

UI test cleanup: Extract many_single_char_names tests #4087

Merged
merged 1 commit into from May 12, 2019
Merged
Changes from all commits
Commits
File filter...
Filter file types
Jump to…
Jump to file or symbol
Failed to load files and symbols.
+126 −121
Diff settings

Always

Just for now

@@ -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() {}
@@ -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

@@ -23,71 +23,6 @@ impl MaybeInst {
}
}

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 underscores_and_numbers() {
let _1 = 1; //~ERROR Consider a more descriptive name
let ____1 = 1; //~ERROR Consider a more descriptive name
@@ -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

ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.