Skip to content

Commit b79663c

Browse files
committed
Update test files
1 parent d3e663b commit b79663c

File tree

6 files changed

+206
-90
lines changed

6 files changed

+206
-90
lines changed

tests/ui/use_self.fixed

+12-27
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,13 @@ mod use_self {
1515
Self {}
1616
}
1717
fn test() -> Self {
18-
// FIXME: applicable here
19-
Foo::new()
18+
Self::new()
2019
}
2120
}
2221

2322
impl Default for Foo {
24-
// FIXME: applicable here
25-
fn default() -> Foo {
26-
// FIXME: applicable here
27-
Foo::new()
23+
fn default() -> Self {
24+
Self::new()
2825
}
2926
}
3027
}
@@ -74,13 +71,12 @@ mod lifetimes {
7471

7572
mod issue2894 {
7673
trait IntoBytes {
77-
#[allow(clippy::wrong_self_convention)]
78-
fn into_bytes(&self) -> Vec<u8>;
74+
fn to_bytes(&self) -> Vec<u8>;
7975
}
8076

8177
// This should not be linted
8278
impl IntoBytes for u8 {
83-
fn into_bytes(&self) -> Vec<u8> {
79+
fn to_bytes(&self) -> Vec<u8> {
8480
vec![*self]
8581
}
8682
}
@@ -90,11 +86,7 @@ mod existential {
9086
struct Foo;
9187

9288
impl Foo {
93-
// FIXME:
94-
// TyKind::Def (used for `impl Trait` types) does not include type parameters yet.
95-
// See documentation in rustc_hir::hir::TyKind.
96-
// The hir tree walk stops at `impl Iterator` level and does not inspect &Foo.
97-
fn bad(foos: &[Self]) -> impl Iterator<Item = &Foo> {
89+
fn bad(foos: &[Self]) -> impl Iterator<Item = &Self> {
9890
foos.iter()
9991
}
10092

@@ -215,10 +207,8 @@ mod rustfix {
215207
fn fun_1() {}
216208

217209
fn fun_2() {
218-
// FIXME: applicable here
219-
nested::A::fun_1();
220-
// FIXME: applicable here
221-
nested::A::A;
210+
Self::fun_1();
211+
Self::A;
222212

223213
Self {};
224214
}
@@ -239,8 +229,7 @@ mod issue3567 {
239229

240230
impl Test for TestStruct {
241231
fn test() -> TestStruct {
242-
// FIXME: applicable here
243-
TestStruct::from_something()
232+
Self::from_something()
244233
}
245234
}
246235
}
@@ -254,14 +243,12 @@ mod paths_created_by_lowering {
254243
const A: usize = 0;
255244
const B: usize = 1;
256245

257-
// FIXME: applicable here
258-
async fn g() -> S {
246+
async fn g() -> Self {
259247
Self {}
260248
}
261249

262250
fn f<'a>(&self, p: &'a [u8]) -> &'a [u8] {
263-
// FIXME: applicable here twice
264-
&p[S::A..S::B]
251+
&p[Self::A..Self::B]
265252
}
266253
}
267254

@@ -381,7 +368,6 @@ mod issue4305 {
381368

382369
impl<T: Foo> From<T> for Box<dyn Foo> {
383370
fn from(t: T) -> Self {
384-
// FIXME: applicable here
385371
Box::new(t)
386372
}
387373
}
@@ -461,8 +447,7 @@ mod nested_paths {
461447

462448
impl A<submod::C> {
463449
fn test() -> Self {
464-
// FIXME: applicable here
465-
A::new::<submod::B>(submod::B {})
450+
Self::new::<submod::B>(submod::B {})
466451
}
467452
}
468453
}

tests/ui/use_self.rs

+2-17
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,12 @@ mod use_self {
1515
Foo {}
1616
}
1717
fn test() -> Foo {
18-
// FIXME: applicable here
1918
Foo::new()
2019
}
2120
}
2221

2322
impl Default for Foo {
24-
// FIXME: applicable here
2523
fn default() -> Foo {
26-
// FIXME: applicable here
2724
Foo::new()
2825
}
2926
}
@@ -74,13 +71,12 @@ mod lifetimes {
7471

7572
mod issue2894 {
7673
trait IntoBytes {
77-
#[allow(clippy::wrong_self_convention)]
78-
fn into_bytes(&self) -> Vec<u8>;
74+
fn to_bytes(&self) -> Vec<u8>;
7975
}
8076

8177
// This should not be linted
8278
impl IntoBytes for u8 {
83-
fn into_bytes(&self) -> Vec<u8> {
79+
fn to_bytes(&self) -> Vec<u8> {
8480
vec![*self]
8581
}
8682
}
@@ -90,10 +86,6 @@ mod existential {
9086
struct Foo;
9187

9288
impl Foo {
93-
// FIXME:
94-
// TyKind::Def (used for `impl Trait` types) does not include type parameters yet.
95-
// See documentation in rustc_hir::hir::TyKind.
96-
// The hir tree walk stops at `impl Iterator` level and does not inspect &Foo.
9789
fn bad(foos: &[Foo]) -> impl Iterator<Item = &Foo> {
9890
foos.iter()
9991
}
@@ -215,9 +207,7 @@ mod rustfix {
215207
fn fun_1() {}
216208

217209
fn fun_2() {
218-
// FIXME: applicable here
219210
nested::A::fun_1();
220-
// FIXME: applicable here
221211
nested::A::A;
222212

223213
nested::A {};
@@ -239,7 +229,6 @@ mod issue3567 {
239229

240230
impl Test for TestStruct {
241231
fn test() -> TestStruct {
242-
// FIXME: applicable here
243232
TestStruct::from_something()
244233
}
245234
}
@@ -254,13 +243,11 @@ mod paths_created_by_lowering {
254243
const A: usize = 0;
255244
const B: usize = 1;
256245

257-
// FIXME: applicable here
258246
async fn g() -> S {
259247
S {}
260248
}
261249

262250
fn f<'a>(&self, p: &'a [u8]) -> &'a [u8] {
263-
// FIXME: applicable here twice
264251
&p[S::A..S::B]
265252
}
266253
}
@@ -381,7 +368,6 @@ mod issue4305 {
381368

382369
impl<T: Foo> From<T> for Box<dyn Foo> {
383370
fn from(t: T) -> Self {
384-
// FIXME: applicable here
385371
Box::new(t)
386372
}
387373
}
@@ -461,7 +447,6 @@ mod nested_paths {
461447

462448
impl A<submod::C> {
463449
fn test() -> Self {
464-
// FIXME: applicable here
465450
A::new::<submod::B>(submod::B {})
466451
}
467452
}

0 commit comments

Comments
 (0)