Skip to content

Commit 032cdfe

Browse files
committed
Adjust use_self uitest to proper self convention
1 parent ea15fb2 commit 032cdfe

File tree

3 files changed

+29
-31
lines changed

3 files changed

+29
-31
lines changed

tests/ui/use_self.fixed

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,14 +75,13 @@ mod lifetimes {
7575

7676
mod issue2894 {
7777
trait IntoBytes {
78-
fn to_bytes(&self) -> Vec<u8>;
78+
fn to_bytes(self) -> Vec<u8>;
7979
}
8080

8181
// This should not be linted
82-
#[allow(clippy::wrong_self_convention)]
8382
impl IntoBytes for u8 {
84-
fn to_bytes(&self) -> Vec<u8> {
85-
vec![*self]
83+
fn to_bytes(self) -> Vec<u8> {
84+
vec![self]
8685
}
8786
}
8887
}

tests/ui/use_self.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,14 +75,13 @@ mod lifetimes {
7575

7676
mod issue2894 {
7777
trait IntoBytes {
78-
fn to_bytes(&self) -> Vec<u8>;
78+
fn to_bytes(self) -> Vec<u8>;
7979
}
8080

8181
// This should not be linted
82-
#[allow(clippy::wrong_self_convention)]
8382
impl IntoBytes for u8 {
84-
fn to_bytes(&self) -> Vec<u8> {
85-
vec![*self]
83+
fn to_bytes(self) -> Vec<u8> {
84+
vec![self]
8685
}
8786
}
8887
}

tests/ui/use_self.stderr

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -37,139 +37,139 @@ LL | Foo::new()
3737
| ^^^ help: use the applicable keyword: `Self`
3838

3939
error: unnecessary structure name repetition
40-
--> $DIR/use_self.rs:94:24
40+
--> $DIR/use_self.rs:93:24
4141
|
4242
LL | fn bad(foos: &[Foo]) -> impl Iterator<Item = &Foo> {
4343
| ^^^ help: use the applicable keyword: `Self`
4444

4545
error: unnecessary structure name repetition
46-
--> $DIR/use_self.rs:94:55
46+
--> $DIR/use_self.rs:93:55
4747
|
4848
LL | fn bad(foos: &[Foo]) -> impl Iterator<Item = &Foo> {
4949
| ^^^ help: use the applicable keyword: `Self`
5050

5151
error: unnecessary structure name repetition
52-
--> $DIR/use_self.rs:109:13
52+
--> $DIR/use_self.rs:108:13
5353
|
5454
LL | TS(0)
5555
| ^^ help: use the applicable keyword: `Self`
5656

5757
error: unnecessary structure name repetition
58-
--> $DIR/use_self.rs:144:29
58+
--> $DIR/use_self.rs:143:29
5959
|
6060
LL | fn bar() -> Bar {
6161
| ^^^ help: use the applicable keyword: `Self`
6262

6363
error: unnecessary structure name repetition
64-
--> $DIR/use_self.rs:145:21
64+
--> $DIR/use_self.rs:144:21
6565
|
6666
LL | Bar { foo: Foo {} }
6767
| ^^^ help: use the applicable keyword: `Self`
6868

6969
error: unnecessary structure name repetition
70-
--> $DIR/use_self.rs:156:21
70+
--> $DIR/use_self.rs:155:21
7171
|
7272
LL | fn baz() -> Foo {
7373
| ^^^ help: use the applicable keyword: `Self`
7474

7575
error: unnecessary structure name repetition
76-
--> $DIR/use_self.rs:157:13
76+
--> $DIR/use_self.rs:156:13
7777
|
7878
LL | Foo {}
7979
| ^^^ help: use the applicable keyword: `Self`
8080

8181
error: unnecessary structure name repetition
82-
--> $DIR/use_self.rs:174:21
82+
--> $DIR/use_self.rs:173:21
8383
|
8484
LL | let _ = Enum::B(42);
8585
| ^^^^ help: use the applicable keyword: `Self`
8686

8787
error: unnecessary structure name repetition
88-
--> $DIR/use_self.rs:175:21
88+
--> $DIR/use_self.rs:174:21
8989
|
9090
LL | let _ = Enum::C { field: true };
9191
| ^^^^ help: use the applicable keyword: `Self`
9292

9393
error: unnecessary structure name repetition
94-
--> $DIR/use_self.rs:176:21
94+
--> $DIR/use_self.rs:175:21
9595
|
9696
LL | let _ = Enum::A;
9797
| ^^^^ help: use the applicable keyword: `Self`
9898

9999
error: unnecessary structure name repetition
100-
--> $DIR/use_self.rs:218:13
100+
--> $DIR/use_self.rs:217:13
101101
|
102102
LL | nested::A::fun_1();
103103
| ^^^^^^^^^ help: use the applicable keyword: `Self`
104104

105105
error: unnecessary structure name repetition
106-
--> $DIR/use_self.rs:219:13
106+
--> $DIR/use_self.rs:218:13
107107
|
108108
LL | nested::A::A;
109109
| ^^^^^^^^^ help: use the applicable keyword: `Self`
110110

111111
error: unnecessary structure name repetition
112-
--> $DIR/use_self.rs:221:13
112+
--> $DIR/use_self.rs:220:13
113113
|
114114
LL | nested::A {};
115115
| ^^^^^^^^^ help: use the applicable keyword: `Self`
116116

117117
error: unnecessary structure name repetition
118-
--> $DIR/use_self.rs:240:13
118+
--> $DIR/use_self.rs:239:13
119119
|
120120
LL | TestStruct::from_something()
121121
| ^^^^^^^^^^ help: use the applicable keyword: `Self`
122122

123123
error: unnecessary structure name repetition
124-
--> $DIR/use_self.rs:254:25
124+
--> $DIR/use_self.rs:253:25
125125
|
126126
LL | async fn g() -> S {
127127
| ^ help: use the applicable keyword: `Self`
128128

129129
error: unnecessary structure name repetition
130-
--> $DIR/use_self.rs:255:13
130+
--> $DIR/use_self.rs:254:13
131131
|
132132
LL | S {}
133133
| ^ help: use the applicable keyword: `Self`
134134

135135
error: unnecessary structure name repetition
136-
--> $DIR/use_self.rs:259:16
136+
--> $DIR/use_self.rs:258:16
137137
|
138138
LL | &p[S::A..S::B]
139139
| ^ help: use the applicable keyword: `Self`
140140

141141
error: unnecessary structure name repetition
142-
--> $DIR/use_self.rs:259:22
142+
--> $DIR/use_self.rs:258:22
143143
|
144144
LL | &p[S::A..S::B]
145145
| ^ help: use the applicable keyword: `Self`
146146

147147
error: unnecessary structure name repetition
148-
--> $DIR/use_self.rs:282:29
148+
--> $DIR/use_self.rs:281:29
149149
|
150150
LL | fn foo(value: T) -> Foo<T> {
151151
| ^^^^^^ help: use the applicable keyword: `Self`
152152

153153
error: unnecessary structure name repetition
154-
--> $DIR/use_self.rs:283:13
154+
--> $DIR/use_self.rs:282:13
155155
|
156156
LL | Foo { value }
157157
| ^^^ help: use the applicable keyword: `Self`
158158

159159
error: unnecessary structure name repetition
160-
--> $DIR/use_self.rs:320:21
160+
--> $DIR/use_self.rs:319:21
161161
|
162162
LL | type From = T::From;
163163
| ^^^^^^^ help: use the applicable keyword: `Self`
164164

165165
error: unnecessary structure name repetition
166-
--> $DIR/use_self.rs:321:19
166+
--> $DIR/use_self.rs:320:19
167167
|
168168
LL | type To = T::To;
169169
| ^^^^^ help: use the applicable keyword: `Self`
170170

171171
error: unnecessary structure name repetition
172-
--> $DIR/use_self.rs:454:13
172+
--> $DIR/use_self.rs:453:13
173173
|
174174
LL | A::new::<submod::B>(submod::B {})
175175
| ^ help: use the applicable keyword: `Self`

0 commit comments

Comments
 (0)