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 similar_names tests #3754

Merged
merged 1 commit into from Feb 10, 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.
+223 −217
Diff settings

Always

Just for now

Copy path View file
@@ -1,87 +1,6 @@
#![warn(clippy::all, clippy::similar_names)]
#![warn(clippy::all)]
#![allow(unused, clippy::println_empty_string)]

struct Foo {
apple: i32,
bpple: i32,
}

fn main() {
let specter: i32;
let spectre: i32;

let apple: i32;

let bpple: i32;

let cpple: i32;

let a_bar: i32;
let b_bar: i32;
let c_bar: i32;

let items = [5];
for item in &items {
loop {}
}

let foo_x: i32;
let foo_y: i32;

let rhs: i32;
let lhs: i32;

let bla_rhs: i32;
let bla_lhs: i32;

let blubrhs: i32;
let blublhs: i32;

let blubx: i32;
let bluby: i32;

let cake: i32;
let cakes: i32;
let coke: i32;

match 5 {
cheese @ 1 => {},
rabbit => panic!(),
}
let cheese: i32;
match (42, 43) {
(cheese1, 1) => {},
(cheese2, 2) => panic!(),
_ => println!(""),
}
let ipv4: i32;
let ipv6: i32;
let abcd1: i32;
let abdc2: i32;
let xyz1abc: i32;
let xyz2abc: i32;
let xyzeabc: i32;

let parser: i32;
let parsed: i32;
let parsee: i32;

let setter: i32;
let getter: i32;
let tx1: i32;
let rx1: i32;
let tx_cake: i32;
let rx_cake: i32;
}

fn foo() {
let Foo { apple, bpple } = unimplemented!();
let Foo {
apple: spring,
bpple: sprang,
} = unimplemented!();
}

#[derive(Clone, Debug)]
enum MaybeInst {
Split,
@@ -160,22 +79,4 @@ impl Bar {
}
}

// false positive similar_names (#3057, #2651)
// clippy claimed total_reg_src_size and total_size and
// numb_reg_src_checkouts and total_bin_size were similar
#[derive(Debug, Clone)]
pub(crate) struct DirSizes {
pub(crate) total_size: u64,
pub(crate) numb_bins: u64,
pub(crate) total_bin_size: u64,
pub(crate) total_reg_size: u64,
pub(crate) total_git_db_size: u64,
pub(crate) total_git_repos_bare_size: u64,
pub(crate) numb_git_repos_bare_repos: u64,
pub(crate) numb_git_checkouts: u64,
pub(crate) total_git_chk_size: u64,
pub(crate) total_reg_cache_size: u64,
pub(crate) total_reg_src_size: u64,
pub(crate) numb_reg_cache_entries: u64,
pub(crate) numb_reg_src_checkouts: u64,
}
fn main() {}
@@ -1,171 +1,66 @@
error: binding's name is too similar to existing binding
--> $DIR/non_expressive_names.rs:15:9
|
LL | let bpple: i32;
| ^^^^^
|
= note: `-D clippy::similar-names` implied by `-D warnings`
note: existing binding defined here
--> $DIR/non_expressive_names.rs:13:9
|
LL | let apple: i32;
| ^^^^^
help: separate the discriminating character by an underscore like: `b_pple`
--> $DIR/non_expressive_names.rs:15:9
|
LL | let bpple: i32;
| ^^^^^

error: binding's name is too similar to existing binding
--> $DIR/non_expressive_names.rs:17:9
|
LL | let cpple: i32;
| ^^^^^
|
note: existing binding defined here
--> $DIR/non_expressive_names.rs:13:9
|
LL | let apple: i32;
| ^^^^^
help: separate the discriminating character by an underscore like: `c_pple`
--> $DIR/non_expressive_names.rs:17:9
|
LL | let cpple: i32;
| ^^^^^

error: binding's name is too similar to existing binding
--> $DIR/non_expressive_names.rs:41:9
|
LL | let bluby: i32;
| ^^^^^
|
note: existing binding defined here
--> $DIR/non_expressive_names.rs:40:9
|
LL | let blubx: i32;
| ^^^^^
help: separate the discriminating character by an underscore like: `blub_y`
--> $DIR/non_expressive_names.rs:41:9
|
LL | let bluby: i32;
| ^^^^^

error: binding's name is too similar to existing binding
--> $DIR/non_expressive_names.rs:45:9
|
LL | let coke: i32;
| ^^^^
|
note: existing binding defined here
--> $DIR/non_expressive_names.rs:43:9
|
LL | let cake: i32;
| ^^^^

error: binding's name is too similar to existing binding
--> $DIR/non_expressive_names.rs:63:9
|
LL | let xyzeabc: i32;
| ^^^^^^^
|
note: existing binding defined here
--> $DIR/non_expressive_names.rs:61:9
|
LL | let xyz1abc: i32;
| ^^^^^^^

error: binding's name is too similar to existing binding
--> $DIR/non_expressive_names.rs:67:9
|
LL | let parsee: i32;
| ^^^^^^
|
note: existing binding defined here
--> $DIR/non_expressive_names.rs:65:9
|
LL | let parser: i32;
| ^^^^^^
help: separate the discriminating character by an underscore like: `parse_e`
--> $DIR/non_expressive_names.rs:67:9
|
LL | let parsee: i32;
| ^^^^^^

error: binding's name is too similar to existing binding
--> $DIR/non_expressive_names.rs:81:16
|
LL | bpple: sprang,
| ^^^^^^
|
note: existing binding defined here
--> $DIR/non_expressive_names.rs:80:16
|
LL | apple: spring,
| ^^^^^^

error: 5th binding whose name is just one char
--> $DIR/non_expressive_names.rs:116:17
--> $DIR/non_expressive_names.rs:35:17
|
LL | let e: i32;
| ^
|
= note: `-D clippy::many-single-char-names` implied by `-D warnings`

error: 5th binding whose name is just one char
--> $DIR/non_expressive_names.rs:119:17
--> $DIR/non_expressive_names.rs:38:17
|
LL | let e: i32;
| ^

error: 6th binding whose name is just one char
--> $DIR/non_expressive_names.rs:120:17
--> $DIR/non_expressive_names.rs:39:17
|
LL | let f: i32;
| ^

error: 5th binding whose name is just one char
--> $DIR/non_expressive_names.rs:124:13
--> $DIR/non_expressive_names.rs:43:13
|
LL | e => panic!(),
| ^

error: consider choosing a more descriptive name
--> $DIR/non_expressive_names.rs:134:9
--> $DIR/non_expressive_names.rs:53: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:135:9
--> $DIR/non_expressive_names.rs:54:9
|
LL | let ____1 = 1; //~ERROR Consider a more descriptive name
| ^^^^^

error: consider choosing a more descriptive name
--> $DIR/non_expressive_names.rs:136:9
--> $DIR/non_expressive_names.rs:55:9
|
LL | let __1___2 = 12; //~ERROR Consider a more descriptive name
| ^^^^^^^

error: consider choosing a more descriptive name
--> $DIR/non_expressive_names.rs:156:13
--> $DIR/non_expressive_names.rs:75:13
|
LL | let _1 = 1;
| ^^

error: consider choosing a more descriptive name
--> $DIR/non_expressive_names.rs:157:13
--> $DIR/non_expressive_names.rs:76:13
|
LL | let ____1 = 1;
| ^^^^^

error: consider choosing a more descriptive name
--> $DIR/non_expressive_names.rs:158:13
--> $DIR/non_expressive_names.rs:77:13
|
LL | let __1___2 = 12;
| ^^^^^^^

error: aborting due to 17 previous errors
error: aborting due to 10 previous errors

Copy path View file
@@ -0,0 +1,103 @@
#![warn(clippy::similar_names)]
#![allow(unused, clippy::println_empty_string)]

struct Foo {
apple: i32,
bpple: i32,
}

fn main() {
let specter: i32;
let spectre: i32;

let apple: i32;

let bpple: i32;

let cpple: i32;

let a_bar: i32;
let b_bar: i32;
let c_bar: i32;

let items = [5];
for item in &items {
loop {}
}

let foo_x: i32;
let foo_y: i32;

let rhs: i32;
let lhs: i32;

let bla_rhs: i32;
let bla_lhs: i32;

let blubrhs: i32;
let blublhs: i32;

let blubx: i32;
let bluby: i32;

let cake: i32;
let cakes: i32;
let coke: i32;

match 5 {
cheese @ 1 => {},
rabbit => panic!(),
}
let cheese: i32;
match (42, 43) {
(cheese1, 1) => {},
(cheese2, 2) => panic!(),
_ => println!(""),
}
let ipv4: i32;
let ipv6: i32;
let abcd1: i32;
let abdc2: i32;
let xyz1abc: i32;
let xyz2abc: i32;
let xyzeabc: i32;

let parser: i32;
let parsed: i32;
let parsee: i32;

let setter: i32;
let getter: i32;
let tx1: i32;
let rx1: i32;
let tx_cake: i32;
let rx_cake: i32;
}

fn foo() {
let Foo { apple, bpple } = unimplemented!();
let Foo {
apple: spring,
bpple: sprang,
} = unimplemented!();
}

// false positive similar_names (#3057, #2651)
// clippy claimed total_reg_src_size and total_size and
// numb_reg_src_checkouts and total_bin_size were similar
#[derive(Debug, Clone)]
pub(crate) struct DirSizes {
pub(crate) total_size: u64,
pub(crate) numb_bins: u64,
pub(crate) total_bin_size: u64,
pub(crate) total_reg_size: u64,
pub(crate) total_git_db_size: u64,
pub(crate) total_git_repos_bare_size: u64,
pub(crate) numb_git_repos_bare_repos: u64,
pub(crate) numb_git_checkouts: u64,
pub(crate) total_git_chk_size: u64,
pub(crate) total_reg_cache_size: u64,
pub(crate) total_reg_src_size: u64,
pub(crate) numb_reg_cache_entries: u64,
pub(crate) numb_reg_src_checkouts: u64,
}
Oops, something went wrong.
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.