Skip to content

Commit c87d999

Browse files
committed
fix ui tests
1 parent d635b76 commit c87d999

13 files changed

+134
-64
lines changed

tests/ui/extra_unused_lifetimes.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
1-
#![allow(unused, dead_code, clippy::needless_lifetimes, clippy::needless_pass_by_value)]
1+
#![allow(
2+
unused,
3+
dead_code,
4+
clippy::needless_lifetimes,
5+
clippy::needless_pass_by_value,
6+
clippy::needless_arbitrary_self_type
7+
)]
28
#![warn(clippy::extra_unused_lifetimes)]
39

410
fn empty() {}

tests/ui/extra_unused_lifetimes.stderr

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,25 @@
11
error: this lifetime isn't used in the function definition
2-
--> $DIR/extra_unused_lifetimes.rs:8:14
2+
--> $DIR/extra_unused_lifetimes.rs:14:14
33
|
44
LL | fn unused_lt<'a>(x: u8) {}
55
| ^^
66
|
77
= note: `-D clippy::extra-unused-lifetimes` implied by `-D warnings`
88

99
error: this lifetime isn't used in the function definition
10-
--> $DIR/extra_unused_lifetimes.rs:10:25
10+
--> $DIR/extra_unused_lifetimes.rs:16:25
1111
|
1212
LL | fn unused_lt_transitive<'a, 'b: 'a>(x: &'b u8) {
1313
| ^^
1414

1515
error: this lifetime isn't used in the function definition
16-
--> $DIR/extra_unused_lifetimes.rs:35:10
16+
--> $DIR/extra_unused_lifetimes.rs:41:10
1717
|
1818
LL | fn x<'a>(&self) {}
1919
| ^^
2020

2121
error: this lifetime isn't used in the function definition
22-
--> $DIR/extra_unused_lifetimes.rs:61:22
22+
--> $DIR/extra_unused_lifetimes.rs:67:22
2323
|
2424
LL | fn unused_lt<'a>(x: u8) {}
2525
| ^^

tests/ui/len_without_is_empty.rs

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@
44
pub struct PubOne;
55

66
impl PubOne {
7-
pub fn len(self: &Self) -> isize {
7+
pub fn len(&self) -> isize {
88
1
99
}
1010
}
1111

1212
impl PubOne {
1313
// A second impl for this struct -- the error span shouldn't mention this.
14-
pub fn irrelevant(self: &Self) -> bool {
14+
pub fn irrelevant(&self) -> bool {
1515
false
1616
}
1717
}
@@ -21,57 +21,57 @@ pub struct PubAllowed;
2121

2222
#[allow(clippy::len_without_is_empty)]
2323
impl PubAllowed {
24-
pub fn len(self: &Self) -> isize {
24+
pub fn len(&self) -> isize {
2525
1
2626
}
2727
}
2828

2929
// No `allow` attribute on this impl block, but that doesn't matter -- we only require one on the
3030
// impl containing `len`.
3131
impl PubAllowed {
32-
pub fn irrelevant(self: &Self) -> bool {
32+
pub fn irrelevant(&self) -> bool {
3333
false
3434
}
3535
}
3636

3737
pub trait PubTraitsToo {
38-
fn len(self: &Self) -> isize;
38+
fn len(&self) -> isize;
3939
}
4040

4141
impl PubTraitsToo for One {
42-
fn len(self: &Self) -> isize {
42+
fn len(&self) -> isize {
4343
0
4444
}
4545
}
4646

4747
pub struct HasIsEmpty;
4848

4949
impl HasIsEmpty {
50-
pub fn len(self: &Self) -> isize {
50+
pub fn len(&self) -> isize {
5151
1
5252
}
5353

54-
fn is_empty(self: &Self) -> bool {
54+
fn is_empty(&self) -> bool {
5555
false
5656
}
5757
}
5858

5959
pub struct HasWrongIsEmpty;
6060

6161
impl HasWrongIsEmpty {
62-
pub fn len(self: &Self) -> isize {
62+
pub fn len(&self) -> isize {
6363
1
6464
}
6565

66-
pub fn is_empty(self: &Self, x: u32) -> bool {
66+
pub fn is_empty(&self, x: u32) -> bool {
6767
false
6868
}
6969
}
7070

7171
struct NotPubOne;
7272

7373
impl NotPubOne {
74-
pub fn len(self: &Self) -> isize {
74+
pub fn len(&self) -> isize {
7575
// No error; `len` is pub but `NotPubOne` is not exported anyway.
7676
1
7777
}
@@ -80,48 +80,48 @@ impl NotPubOne {
8080
struct One;
8181

8282
impl One {
83-
fn len(self: &Self) -> isize {
83+
fn len(&self) -> isize {
8484
// No error; `len` is private; see issue #1085.
8585
1
8686
}
8787
}
8888

8989
trait TraitsToo {
90-
fn len(self: &Self) -> isize;
90+
fn len(&self) -> isize;
9191
// No error; `len` is private; see issue #1085.
9292
}
9393

9494
impl TraitsToo for One {
95-
fn len(self: &Self) -> isize {
95+
fn len(&self) -> isize {
9696
0
9797
}
9898
}
9999

100100
struct HasPrivateIsEmpty;
101101

102102
impl HasPrivateIsEmpty {
103-
pub fn len(self: &Self) -> isize {
103+
pub fn len(&self) -> isize {
104104
1
105105
}
106106

107-
fn is_empty(self: &Self) -> bool {
107+
fn is_empty(&self) -> bool {
108108
false
109109
}
110110
}
111111

112112
struct Wither;
113113

114114
pub trait WithIsEmpty {
115-
fn len(self: &Self) -> isize;
116-
fn is_empty(self: &Self) -> bool;
115+
fn len(&self) -> isize;
116+
fn is_empty(&self) -> bool;
117117
}
118118

119119
impl WithIsEmpty for Wither {
120-
fn len(self: &Self) -> isize {
120+
fn len(&self) -> isize {
121121
1
122122
}
123123

124-
fn is_empty(self: &Self) -> bool {
124+
fn is_empty(&self) -> bool {
125125
false
126126
}
127127
}

tests/ui/len_without_is_empty.stderr

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ error: item `PubOne` has a public `len` method but no corresponding `is_empty` m
22
--> $DIR/len_without_is_empty.rs:6:1
33
|
44
LL | / impl PubOne {
5-
LL | | pub fn len(self: &Self) -> isize {
5+
LL | | pub fn len(&self) -> isize {
66
LL | | 1
77
LL | | }
88
LL | | }
@@ -14,15 +14,15 @@ error: trait `PubTraitsToo` has a `len` method but no (possibly inherited) `is_e
1414
--> $DIR/len_without_is_empty.rs:37:1
1515
|
1616
LL | / pub trait PubTraitsToo {
17-
LL | | fn len(self: &Self) -> isize;
17+
LL | | fn len(&self) -> isize;
1818
LL | | }
1919
| |_^
2020

2121
error: item `HasIsEmpty` has a public `len` method but a private `is_empty` method
2222
--> $DIR/len_without_is_empty.rs:49:1
2323
|
2424
LL | / impl HasIsEmpty {
25-
LL | | pub fn len(self: &Self) -> isize {
25+
LL | | pub fn len(&self) -> isize {
2626
LL | | 1
2727
LL | | }
2828
... |
@@ -34,7 +34,7 @@ error: item `HasWrongIsEmpty` has a public `len` method but no corresponding `is
3434
--> $DIR/len_without_is_empty.rs:61:1
3535
|
3636
LL | / impl HasWrongIsEmpty {
37-
LL | | pub fn len(self: &Self) -> isize {
37+
LL | | pub fn len(&self) -> isize {
3838
LL | | 1
3939
LL | | }
4040
... |

tests/ui/len_zero.fixed

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,51 +7,51 @@ pub struct One;
77
struct Wither;
88

99
trait TraitsToo {
10-
fn len(self: &Self) -> isize;
10+
fn len(&self) -> isize;
1111
// No error; `len` is private; see issue #1085.
1212
}
1313

1414
impl TraitsToo for One {
15-
fn len(self: &Self) -> isize {
15+
fn len(&self) -> isize {
1616
0
1717
}
1818
}
1919

2020
pub struct HasIsEmpty;
2121

2222
impl HasIsEmpty {
23-
pub fn len(self: &Self) -> isize {
23+
pub fn len(&self) -> isize {
2424
1
2525
}
2626

27-
fn is_empty(self: &Self) -> bool {
27+
fn is_empty(&self) -> bool {
2828
false
2929
}
3030
}
3131

3232
pub struct HasWrongIsEmpty;
3333

3434
impl HasWrongIsEmpty {
35-
pub fn len(self: &Self) -> isize {
35+
pub fn len(&self) -> isize {
3636
1
3737
}
3838

39-
pub fn is_empty(self: &Self, x: u32) -> bool {
39+
pub fn is_empty(&self, x: u32) -> bool {
4040
false
4141
}
4242
}
4343

4444
pub trait WithIsEmpty {
45-
fn len(self: &Self) -> isize;
46-
fn is_empty(self: &Self) -> bool;
45+
fn len(&self) -> isize;
46+
fn is_empty(&self) -> bool;
4747
}
4848

4949
impl WithIsEmpty for Wither {
50-
fn len(self: &Self) -> isize {
50+
fn len(&self) -> isize {
5151
1
5252
}
5353

54-
fn is_empty(self: &Self) -> bool {
54+
fn is_empty(&self) -> bool {
5555
false
5656
}
5757
}

tests/ui/len_zero.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,51 +7,51 @@ pub struct One;
77
struct Wither;
88

99
trait TraitsToo {
10-
fn len(self: &Self) -> isize;
10+
fn len(&self) -> isize;
1111
// No error; `len` is private; see issue #1085.
1212
}
1313

1414
impl TraitsToo for One {
15-
fn len(self: &Self) -> isize {
15+
fn len(&self) -> isize {
1616
0
1717
}
1818
}
1919

2020
pub struct HasIsEmpty;
2121

2222
impl HasIsEmpty {
23-
pub fn len(self: &Self) -> isize {
23+
pub fn len(&self) -> isize {
2424
1
2525
}
2626

27-
fn is_empty(self: &Self) -> bool {
27+
fn is_empty(&self) -> bool {
2828
false
2929
}
3030
}
3131

3232
pub struct HasWrongIsEmpty;
3333

3434
impl HasWrongIsEmpty {
35-
pub fn len(self: &Self) -> isize {
35+
pub fn len(&self) -> isize {
3636
1
3737
}
3838

39-
pub fn is_empty(self: &Self, x: u32) -> bool {
39+
pub fn is_empty(&self, x: u32) -> bool {
4040
false
4141
}
4242
}
4343

4444
pub trait WithIsEmpty {
45-
fn len(self: &Self) -> isize;
46-
fn is_empty(self: &Self) -> bool;
45+
fn len(&self) -> isize;
46+
fn is_empty(&self) -> bool;
4747
}
4848

4949
impl WithIsEmpty for Wither {
50-
fn len(self: &Self) -> isize {
50+
fn len(&self) -> isize {
5151
1
5252
}
5353

54-
fn is_empty(self: &Self) -> bool {
54+
fn is_empty(&self) -> bool {
5555
false
5656
}
5757
}

0 commit comments

Comments
 (0)