about summary refs log tree commit diff
diff options
context:
space:
mode:
authorYuki Okushi <huyuumi.dev@gmail.com>2020-01-10 08:56:16 +0900
committerYuki Okushi <huyuumi.dev@gmail.com>2020-01-12 06:08:58 +0900
commit291f2cbeb80b7313d2ba3a7dbe1b4d0f6a6ab1b6 (patch)
treea6d0a1b3813a4333d080fccc36fd9046119f10f7
parent2677a4ef02ce309be49643ad7cd0beab6375a0f3 (diff)
downloadrust-291f2cbeb80b7313d2ba3a7dbe1b4d0f6a6ab1b6.tar.gz
rust-291f2cbeb80b7313d2ba3a7dbe1b4d0f6a6ab1b6.zip
Split up `use_self` ui test
-rw-r--r--tests/ui/use_self.fixed111
-rw-r--r--tests/ui/use_self.rs111
-rw-r--r--tests/ui/use_self.stderr130
-rw-r--r--tests/ui/use_self_trait.fixed114
-rw-r--r--tests/ui/use_self_trait.rs114
-rw-r--r--tests/ui/use_self_trait.stderr94
6 files changed, 342 insertions, 332 deletions
diff --git a/tests/ui/use_self.fixed b/tests/ui/use_self.fixed
index 55809116882..802de31b783 100644
--- a/tests/ui/use_self.fixed
+++ b/tests/ui/use_self.fixed
@@ -69,117 +69,6 @@ mod lifetimes {
     }
 }
 
-#[allow(clippy::boxed_local)]
-mod traits {
-
-    use std::ops::Mul;
-
-    trait SelfTrait {
-        fn refs(p1: &Self) -> &Self;
-        fn ref_refs<'a>(p1: &'a &'a Self) -> &'a &'a Self;
-        fn mut_refs(p1: &mut Self) -> &mut Self;
-        fn nested(p1: Box<Self>, p2: (&u8, &Self));
-        fn vals(r: Self) -> Self;
-    }
-
-    #[derive(Default)]
-    struct Bad;
-
-    impl SelfTrait for Bad {
-        fn refs(p1: &Self) -> &Self {
-            p1
-        }
-
-        fn ref_refs<'a>(p1: &'a &'a Self) -> &'a &'a Self {
-            p1
-        }
-
-        fn mut_refs(p1: &mut Self) -> &mut Self {
-            p1
-        }
-
-        fn nested(_p1: Box<Self>, _p2: (&u8, &Self)) {}
-
-        fn vals(_: Self) -> Self {
-            Self::default()
-        }
-    }
-
-    impl Mul for Bad {
-        type Output = Self;
-
-        fn mul(self, rhs: Self) -> Self {
-            rhs
-        }
-    }
-
-    impl Clone for Bad {
-        fn clone(&self) -> Self {
-            Self
-        }
-    }
-
-    #[derive(Default)]
-    struct Good;
-
-    impl SelfTrait for Good {
-        fn refs(p1: &Self) -> &Self {
-            p1
-        }
-
-        fn ref_refs<'a>(p1: &'a &'a Self) -> &'a &'a Self {
-            p1
-        }
-
-        fn mut_refs(p1: &mut Self) -> &mut Self {
-            p1
-        }
-
-        fn nested(_p1: Box<Self>, _p2: (&u8, &Self)) {}
-
-        fn vals(_: Self) -> Self {
-            Self::default()
-        }
-    }
-
-    impl Mul for Good {
-        type Output = Self;
-
-        fn mul(self, rhs: Self) -> Self {
-            rhs
-        }
-    }
-
-    trait NameTrait {
-        fn refs(p1: &u8) -> &u8;
-        fn ref_refs<'a>(p1: &'a &'a u8) -> &'a &'a u8;
-        fn mut_refs(p1: &mut u8) -> &mut u8;
-        fn nested(p1: Box<u8>, p2: (&u8, &u8));
-        fn vals(p1: u8) -> u8;
-    }
-
-    // Using `Self` instead of the type name is OK
-    impl NameTrait for u8 {
-        fn refs(p1: &Self) -> &Self {
-            p1
-        }
-
-        fn ref_refs<'a>(p1: &'a &'a Self) -> &'a &'a Self {
-            p1
-        }
-
-        fn mut_refs(p1: &mut Self) -> &mut Self {
-            p1
-        }
-
-        fn nested(_p1: Box<Self>, _p2: (&Self, &Self)) {}
-
-        fn vals(_: Self) -> Self {
-            Self::default()
-        }
-    }
-}
-
 mod issue2894 {
     trait IntoBytes {
         fn into_bytes(&self) -> Vec<u8>;
diff --git a/tests/ui/use_self.rs b/tests/ui/use_self.rs
index 3bd89691875..605c4f8c41f 100644
--- a/tests/ui/use_self.rs
+++ b/tests/ui/use_self.rs
@@ -69,117 +69,6 @@ mod lifetimes {
     }
 }
 
-#[allow(clippy::boxed_local)]
-mod traits {
-
-    use std::ops::Mul;
-
-    trait SelfTrait {
-        fn refs(p1: &Self) -> &Self;
-        fn ref_refs<'a>(p1: &'a &'a Self) -> &'a &'a Self;
-        fn mut_refs(p1: &mut Self) -> &mut Self;
-        fn nested(p1: Box<Self>, p2: (&u8, &Self));
-        fn vals(r: Self) -> Self;
-    }
-
-    #[derive(Default)]
-    struct Bad;
-
-    impl SelfTrait for Bad {
-        fn refs(p1: &Bad) -> &Bad {
-            p1
-        }
-
-        fn ref_refs<'a>(p1: &'a &'a Bad) -> &'a &'a Bad {
-            p1
-        }
-
-        fn mut_refs(p1: &mut Bad) -> &mut Bad {
-            p1
-        }
-
-        fn nested(_p1: Box<Bad>, _p2: (&u8, &Bad)) {}
-
-        fn vals(_: Bad) -> Bad {
-            Bad::default()
-        }
-    }
-
-    impl Mul for Bad {
-        type Output = Bad;
-
-        fn mul(self, rhs: Bad) -> Bad {
-            rhs
-        }
-    }
-
-    impl Clone for Bad {
-        fn clone(&self) -> Self {
-            Bad
-        }
-    }
-
-    #[derive(Default)]
-    struct Good;
-
-    impl SelfTrait for Good {
-        fn refs(p1: &Self) -> &Self {
-            p1
-        }
-
-        fn ref_refs<'a>(p1: &'a &'a Self) -> &'a &'a Self {
-            p1
-        }
-
-        fn mut_refs(p1: &mut Self) -> &mut Self {
-            p1
-        }
-
-        fn nested(_p1: Box<Self>, _p2: (&u8, &Self)) {}
-
-        fn vals(_: Self) -> Self {
-            Self::default()
-        }
-    }
-
-    impl Mul for Good {
-        type Output = Self;
-
-        fn mul(self, rhs: Self) -> Self {
-            rhs
-        }
-    }
-
-    trait NameTrait {
-        fn refs(p1: &u8) -> &u8;
-        fn ref_refs<'a>(p1: &'a &'a u8) -> &'a &'a u8;
-        fn mut_refs(p1: &mut u8) -> &mut u8;
-        fn nested(p1: Box<u8>, p2: (&u8, &u8));
-        fn vals(p1: u8) -> u8;
-    }
-
-    // Using `Self` instead of the type name is OK
-    impl NameTrait for u8 {
-        fn refs(p1: &Self) -> &Self {
-            p1
-        }
-
-        fn ref_refs<'a>(p1: &'a &'a Self) -> &'a &'a Self {
-            p1
-        }
-
-        fn mut_refs(p1: &mut Self) -> &mut Self {
-            p1
-        }
-
-        fn nested(_p1: Box<Self>, _p2: (&Self, &Self)) {}
-
-        fn vals(_: Self) -> Self {
-            Self::default()
-        }
-    }
-}
-
 mod issue2894 {
     trait IntoBytes {
         fn into_bytes(&self) -> Vec<u8>;
diff --git a/tests/ui/use_self.stderr b/tests/ui/use_self.stderr
index 664f91b1460..3cdb1cb3249 100644
--- a/tests/ui/use_self.stderr
+++ b/tests/ui/use_self.stderr
@@ -37,109 +37,19 @@ LL |             Foo::new()
    |             ^^^ help: use the applicable keyword: `Self`
 
 error: unnecessary structure name repetition
-  --> $DIR/use_self.rs:89:22
-   |
-LL |         fn refs(p1: &Bad) -> &Bad {
-   |                      ^^^ help: use the applicable keyword: `Self`
-
-error: unnecessary structure name repetition
-  --> $DIR/use_self.rs:89:31
-   |
-LL |         fn refs(p1: &Bad) -> &Bad {
-   |                               ^^^ help: use the applicable keyword: `Self`
-
-error: unnecessary structure name repetition
-  --> $DIR/use_self.rs:93:37
-   |
-LL |         fn ref_refs<'a>(p1: &'a &'a Bad) -> &'a &'a Bad {
-   |                                     ^^^ help: use the applicable keyword: `Self`
-
-error: unnecessary structure name repetition
-  --> $DIR/use_self.rs:93:53
-   |
-LL |         fn ref_refs<'a>(p1: &'a &'a Bad) -> &'a &'a Bad {
-   |                                                     ^^^ help: use the applicable keyword: `Self`
-
-error: unnecessary structure name repetition
-  --> $DIR/use_self.rs:97:30
-   |
-LL |         fn mut_refs(p1: &mut Bad) -> &mut Bad {
-   |                              ^^^ help: use the applicable keyword: `Self`
-
-error: unnecessary structure name repetition
-  --> $DIR/use_self.rs:97:43
-   |
-LL |         fn mut_refs(p1: &mut Bad) -> &mut Bad {
-   |                                           ^^^ help: use the applicable keyword: `Self`
-
-error: unnecessary structure name repetition
-  --> $DIR/use_self.rs:101:28
-   |
-LL |         fn nested(_p1: Box<Bad>, _p2: (&u8, &Bad)) {}
-   |                            ^^^ help: use the applicable keyword: `Self`
-
-error: unnecessary structure name repetition
-  --> $DIR/use_self.rs:101:46
-   |
-LL |         fn nested(_p1: Box<Bad>, _p2: (&u8, &Bad)) {}
-   |                                              ^^^ help: use the applicable keyword: `Self`
-
-error: unnecessary structure name repetition
-  --> $DIR/use_self.rs:103:20
-   |
-LL |         fn vals(_: Bad) -> Bad {
-   |                    ^^^ help: use the applicable keyword: `Self`
-
-error: unnecessary structure name repetition
-  --> $DIR/use_self.rs:103:28
-   |
-LL |         fn vals(_: Bad) -> Bad {
-   |                            ^^^ help: use the applicable keyword: `Self`
-
-error: unnecessary structure name repetition
-  --> $DIR/use_self.rs:104:13
-   |
-LL |             Bad::default()
-   |             ^^^ help: use the applicable keyword: `Self`
-
-error: unnecessary structure name repetition
-  --> $DIR/use_self.rs:109:23
-   |
-LL |         type Output = Bad;
-   |                       ^^^ help: use the applicable keyword: `Self`
-
-error: unnecessary structure name repetition
-  --> $DIR/use_self.rs:111:27
-   |
-LL |         fn mul(self, rhs: Bad) -> Bad {
-   |                           ^^^ help: use the applicable keyword: `Self`
-
-error: unnecessary structure name repetition
-  --> $DIR/use_self.rs:111:35
-   |
-LL |         fn mul(self, rhs: Bad) -> Bad {
-   |                                   ^^^ help: use the applicable keyword: `Self`
-
-error: unnecessary structure name repetition
-  --> $DIR/use_self.rs:118:13
-   |
-LL |             Bad
-   |             ^^^ help: use the applicable keyword: `Self`
-
-error: unnecessary structure name repetition
-  --> $DIR/use_self.rs:200:56
+  --> $DIR/use_self.rs:89:56
    |
 LL |         fn bad(foos: &[Self]) -> impl Iterator<Item = &Foo> {
    |                                                        ^^^ help: use the applicable keyword: `Self`
 
 error: unnecessary structure name repetition
-  --> $DIR/use_self.rs:215:13
+  --> $DIR/use_self.rs:104:13
    |
 LL |             TS(0)
    |             ^^ help: use the applicable keyword: `Self`
 
 error: unnecessary structure name repetition
-  --> $DIR/use_self.rs:223:25
+  --> $DIR/use_self.rs:112:25
    |
 LL |             fn new() -> Foo {
    |                         ^^^ help: use the applicable keyword: `Self`
@@ -148,7 +58,7 @@ LL |         use_self_expand!(); // Should lint in local macros
    |         ------------------- in this macro invocation
 
 error: unnecessary structure name repetition
-  --> $DIR/use_self.rs:224:17
+  --> $DIR/use_self.rs:113:17
    |
 LL |                 Foo {}
    |                 ^^^ help: use the applicable keyword: `Self`
@@ -157,94 +67,94 @@ LL |         use_self_expand!(); // Should lint in local macros
    |         ------------------- in this macro invocation
 
 error: unnecessary structure name repetition
-  --> $DIR/use_self.rs:259:21
+  --> $DIR/use_self.rs:148:21
    |
 LL |         fn baz() -> Foo {
    |                     ^^^ help: use the applicable keyword: `Self`
 
 error: unnecessary structure name repetition
-  --> $DIR/use_self.rs:260:13
+  --> $DIR/use_self.rs:149:13
    |
 LL |             Foo {}
    |             ^^^ help: use the applicable keyword: `Self`
 
 error: unnecessary structure name repetition
-  --> $DIR/use_self.rs:247:29
+  --> $DIR/use_self.rs:136:29
    |
 LL |                 fn bar() -> Bar {
    |                             ^^^ help: use the applicable keyword: `Self`
 
 error: unnecessary structure name repetition
-  --> $DIR/use_self.rs:248:21
+  --> $DIR/use_self.rs:137:21
    |
 LL |                     Bar { foo: Foo {} }
    |                     ^^^ help: use the applicable keyword: `Self`
 
 error: unnecessary structure name repetition
-  --> $DIR/use_self.rs:277:21
+  --> $DIR/use_self.rs:166:21
    |
 LL |             let _ = Enum::B(42);
    |                     ^^^^ help: use the applicable keyword: `Self`
 
 error: unnecessary structure name repetition
-  --> $DIR/use_self.rs:278:21
+  --> $DIR/use_self.rs:167:21
    |
 LL |             let _ = Enum::C { field: true };
    |                     ^^^^ help: use the applicable keyword: `Self`
 
 error: unnecessary structure name repetition
-  --> $DIR/use_self.rs:279:21
+  --> $DIR/use_self.rs:168:21
    |
 LL |             let _ = Enum::A;
    |                     ^^^^ help: use the applicable keyword: `Self`
 
 error: unnecessary structure name repetition
-  --> $DIR/use_self.rs:310:13
+  --> $DIR/use_self.rs:199:13
    |
 LL |             nested::A::fun_1();
    |             ^^^^^^^^^ help: use the applicable keyword: `Self`
 
 error: unnecessary structure name repetition
-  --> $DIR/use_self.rs:311:13
+  --> $DIR/use_self.rs:200:13
    |
 LL |             nested::A::A;
    |             ^^^^^^^^^ help: use the applicable keyword: `Self`
 
 error: unnecessary structure name repetition
-  --> $DIR/use_self.rs:313:13
+  --> $DIR/use_self.rs:202:13
    |
 LL |             nested::A {};
    |             ^^^^^^^^^ help: use the applicable keyword: `Self`
 
 error: unnecessary structure name repetition
-  --> $DIR/use_self.rs:332:13
+  --> $DIR/use_self.rs:221:13
    |
 LL |             TestStruct::from_something()
    |             ^^^^^^^^^^ help: use the applicable keyword: `Self`
 
 error: unnecessary structure name repetition
-  --> $DIR/use_self.rs:346:25
+  --> $DIR/use_self.rs:235:25
    |
 LL |         async fn g() -> S {
    |                         ^ help: use the applicable keyword: `Self`
 
 error: unnecessary structure name repetition
-  --> $DIR/use_self.rs:347:13
+  --> $DIR/use_self.rs:236:13
    |
 LL |             S {}
    |             ^ help: use the applicable keyword: `Self`
 
 error: unnecessary structure name repetition
-  --> $DIR/use_self.rs:351:16
+  --> $DIR/use_self.rs:240:16
    |
 LL |             &p[S::A..S::B]
    |                ^ help: use the applicable keyword: `Self`
 
 error: unnecessary structure name repetition
-  --> $DIR/use_self.rs:351:22
+  --> $DIR/use_self.rs:240:22
    |
 LL |             &p[S::A..S::B]
    |                      ^ help: use the applicable keyword: `Self`
 
-error: aborting due to 40 previous errors
+error: aborting due to 25 previous errors
 
diff --git a/tests/ui/use_self_trait.fixed b/tests/ui/use_self_trait.fixed
new file mode 100644
index 00000000000..1582ae114bf
--- /dev/null
+++ b/tests/ui/use_self_trait.fixed
@@ -0,0 +1,114 @@
+// run-rustfix
+
+#![warn(clippy::use_self)]
+#![allow(dead_code)]
+#![allow(clippy::should_implement_trait, clippy::boxed_local)]
+
+use std::ops::Mul;
+
+trait SelfTrait {
+    fn refs(p1: &Self) -> &Self;
+    fn ref_refs<'a>(p1: &'a &'a Self) -> &'a &'a Self;
+    fn mut_refs(p1: &mut Self) -> &mut Self;
+    fn nested(p1: Box<Self>, p2: (&u8, &Self));
+    fn vals(r: Self) -> Self;
+}
+
+#[derive(Default)]
+struct Bad;
+
+impl SelfTrait for Bad {
+    fn refs(p1: &Self) -> &Self {
+        p1
+    }
+
+    fn ref_refs<'a>(p1: &'a &'a Self) -> &'a &'a Self {
+        p1
+    }
+
+    fn mut_refs(p1: &mut Self) -> &mut Self {
+        p1
+    }
+
+    fn nested(_p1: Box<Self>, _p2: (&u8, &Self)) {}
+
+    fn vals(_: Self) -> Self {
+        Self::default()
+    }
+}
+
+impl Mul for Bad {
+    type Output = Self;
+
+    fn mul(self, rhs: Self) -> Self {
+        rhs
+    }
+}
+
+impl Clone for Bad {
+    fn clone(&self) -> Self {
+        Self
+    }
+}
+
+#[derive(Default)]
+struct Good;
+
+impl SelfTrait for Good {
+    fn refs(p1: &Self) -> &Self {
+        p1
+    }
+
+    fn ref_refs<'a>(p1: &'a &'a Self) -> &'a &'a Self {
+        p1
+    }
+
+    fn mut_refs(p1: &mut Self) -> &mut Self {
+        p1
+    }
+
+    fn nested(_p1: Box<Self>, _p2: (&u8, &Self)) {}
+
+    fn vals(_: Self) -> Self {
+        Self::default()
+    }
+}
+
+impl Mul for Good {
+    type Output = Self;
+
+    fn mul(self, rhs: Self) -> Self {
+        rhs
+    }
+}
+
+trait NameTrait {
+    fn refs(p1: &u8) -> &u8;
+    fn ref_refs<'a>(p1: &'a &'a u8) -> &'a &'a u8;
+    fn mut_refs(p1: &mut u8) -> &mut u8;
+    fn nested(p1: Box<u8>, p2: (&u8, &u8));
+    fn vals(p1: u8) -> u8;
+}
+
+// Using `Self` instead of the type name is OK
+impl NameTrait for u8 {
+    fn refs(p1: &Self) -> &Self {
+        p1
+    }
+
+    fn ref_refs<'a>(p1: &'a &'a Self) -> &'a &'a Self {
+        p1
+    }
+
+    fn mut_refs(p1: &mut Self) -> &mut Self {
+        p1
+    }
+
+    fn nested(_p1: Box<Self>, _p2: (&Self, &Self)) {}
+
+    fn vals(_: Self) -> Self {
+        Self::default()
+    }
+}
+
+fn main() {}
diff --git a/tests/ui/use_self_trait.rs b/tests/ui/use_self_trait.rs
new file mode 100644
index 00000000000..70667b9797e
--- /dev/null
+++ b/tests/ui/use_self_trait.rs
@@ -0,0 +1,114 @@
+// run-rustfix
+
+#![warn(clippy::use_self)]
+#![allow(dead_code)]
+#![allow(clippy::should_implement_trait, clippy::boxed_local)]
+
+use std::ops::Mul;
+
+trait SelfTrait {
+    fn refs(p1: &Self) -> &Self;
+    fn ref_refs<'a>(p1: &'a &'a Self) -> &'a &'a Self;
+    fn mut_refs(p1: &mut Self) -> &mut Self;
+    fn nested(p1: Box<Self>, p2: (&u8, &Self));
+    fn vals(r: Self) -> Self;
+}
+
+#[derive(Default)]
+struct Bad;
+
+impl SelfTrait for Bad {
+    fn refs(p1: &Bad) -> &Bad {
+        p1
+    }
+
+    fn ref_refs<'a>(p1: &'a &'a Bad) -> &'a &'a Bad {
+        p1
+    }
+
+    fn mut_refs(p1: &mut Bad) -> &mut Bad {
+        p1
+    }
+
+    fn nested(_p1: Box<Bad>, _p2: (&u8, &Bad)) {}
+
+    fn vals(_: Bad) -> Bad {
+        Bad::default()
+    }
+}
+
+impl Mul for Bad {
+    type Output = Bad;
+
+    fn mul(self, rhs: Bad) -> Bad {
+        rhs
+    }
+}
+
+impl Clone for Bad {
+    fn clone(&self) -> Self {
+        Bad
+    }
+}
+
+#[derive(Default)]
+struct Good;
+
+impl SelfTrait for Good {
+    fn refs(p1: &Self) -> &Self {
+        p1
+    }
+
+    fn ref_refs<'a>(p1: &'a &'a Self) -> &'a &'a Self {
+        p1
+    }
+
+    fn mut_refs(p1: &mut Self) -> &mut Self {
+        p1
+    }
+
+    fn nested(_p1: Box<Self>, _p2: (&u8, &Self)) {}
+
+    fn vals(_: Self) -> Self {
+        Self::default()
+    }
+}
+
+impl Mul for Good {
+    type Output = Self;
+
+    fn mul(self, rhs: Self) -> Self {
+        rhs
+    }
+}
+
+trait NameTrait {
+    fn refs(p1: &u8) -> &u8;
+    fn ref_refs<'a>(p1: &'a &'a u8) -> &'a &'a u8;
+    fn mut_refs(p1: &mut u8) -> &mut u8;
+    fn nested(p1: Box<u8>, p2: (&u8, &u8));
+    fn vals(p1: u8) -> u8;
+}
+
+// Using `Self` instead of the type name is OK
+impl NameTrait for u8 {
+    fn refs(p1: &Self) -> &Self {
+        p1
+    }
+
+    fn ref_refs<'a>(p1: &'a &'a Self) -> &'a &'a Self {
+        p1
+    }
+
+    fn mut_refs(p1: &mut Self) -> &mut Self {
+        p1
+    }
+
+    fn nested(_p1: Box<Self>, _p2: (&Self, &Self)) {}
+
+    fn vals(_: Self) -> Self {
+        Self::default()
+    }
+}
+
+fn main() {}
diff --git a/tests/ui/use_self_trait.stderr b/tests/ui/use_self_trait.stderr
new file mode 100644
index 00000000000..4f2506cc119
--- /dev/null
+++ b/tests/ui/use_self_trait.stderr
@@ -0,0 +1,94 @@
+error: unnecessary structure name repetition
+  --> $DIR/use_self_trait.rs:21:18
+   |
+LL |     fn refs(p1: &Bad) -> &Bad {
+   |                  ^^^ help: use the applicable keyword: `Self`
+   |
+   = note: `-D clippy::use-self` implied by `-D warnings`
+
+error: unnecessary structure name repetition
+  --> $DIR/use_self_trait.rs:21:27
+   |
+LL |     fn refs(p1: &Bad) -> &Bad {
+   |                           ^^^ help: use the applicable keyword: `Self`
+
+error: unnecessary structure name repetition
+  --> $DIR/use_self_trait.rs:25:33
+   |
+LL |     fn ref_refs<'a>(p1: &'a &'a Bad) -> &'a &'a Bad {
+   |                                 ^^^ help: use the applicable keyword: `Self`
+
+error: unnecessary structure name repetition
+  --> $DIR/use_self_trait.rs:25:49
+   |
+LL |     fn ref_refs<'a>(p1: &'a &'a Bad) -> &'a &'a Bad {
+   |                                                 ^^^ help: use the applicable keyword: `Self`
+
+error: unnecessary structure name repetition
+  --> $DIR/use_self_trait.rs:29:26
+   |
+LL |     fn mut_refs(p1: &mut Bad) -> &mut Bad {
+   |                          ^^^ help: use the applicable keyword: `Self`
+
+error: unnecessary structure name repetition
+  --> $DIR/use_self_trait.rs:29:39
+   |
+LL |     fn mut_refs(p1: &mut Bad) -> &mut Bad {
+   |                                       ^^^ help: use the applicable keyword: `Self`
+
+error: unnecessary structure name repetition
+  --> $DIR/use_self_trait.rs:33:24
+   |
+LL |     fn nested(_p1: Box<Bad>, _p2: (&u8, &Bad)) {}
+   |                        ^^^ help: use the applicable keyword: `Self`
+
+error: unnecessary structure name repetition
+  --> $DIR/use_self_trait.rs:33:42
+   |
+LL |     fn nested(_p1: Box<Bad>, _p2: (&u8, &Bad)) {}
+   |                                          ^^^ help: use the applicable keyword: `Self`
+
+error: unnecessary structure name repetition
+  --> $DIR/use_self_trait.rs:35:16
+   |
+LL |     fn vals(_: Bad) -> Bad {
+   |                ^^^ help: use the applicable keyword: `Self`
+
+error: unnecessary structure name repetition
+  --> $DIR/use_self_trait.rs:35:24
+   |
+LL |     fn vals(_: Bad) -> Bad {
+   |                        ^^^ help: use the applicable keyword: `Self`
+
+error: unnecessary structure name repetition
+  --> $DIR/use_self_trait.rs:36:9
+   |
+LL |         Bad::default()
+   |         ^^^ help: use the applicable keyword: `Self`
+
+error: unnecessary structure name repetition
+  --> $DIR/use_self_trait.rs:41:19
+   |
+LL |     type Output = Bad;
+   |                   ^^^ help: use the applicable keyword: `Self`
+
+error: unnecessary structure name repetition
+  --> $DIR/use_self_trait.rs:43:23
+   |
+LL |     fn mul(self, rhs: Bad) -> Bad {
+   |                       ^^^ help: use the applicable keyword: `Self`
+
+error: unnecessary structure name repetition
+  --> $DIR/use_self_trait.rs:43:31
+   |
+LL |     fn mul(self, rhs: Bad) -> Bad {
+   |                               ^^^ help: use the applicable keyword: `Self`
+
+error: unnecessary structure name repetition
+  --> $DIR/use_self_trait.rs:50:9
+   |
+LL |         Bad
+   |         ^^^ help: use the applicable keyword: `Self`
+
+error: aborting due to 15 previous errors
+