]> git.lizzy.rs Git - rust.git/blobdiff - tests/ui/new_ret_no_self.rs
new_ret_no_self correctly lint impl return
[rust.git] / tests / ui / new_ret_no_self.rs
index 3b7ff7780ef7503221df1385919be2011d0c6e8b..e9f41d3413360063c8a971309a9ac04dacf6460d 100644 (file)
@@ -9,6 +9,11 @@ trait R {
     type Item;
 }
 
+trait Q {
+    type Item;
+    type Item2;
+}
+
 struct S;
 
 impl R for S {
@@ -42,12 +47,26 @@ impl R for S3 {
 }
 
 impl S3 {
-    // should trigger the lint, but currently does not
+    // should trigger the lint
     pub fn new(_: String) -> impl R<Item = u32> {
         S3
     }
 }
 
+struct S4;
+
+impl Q for S4 {
+    type Item = u32;
+    type Item2 = Self;
+}
+
+impl S4 {
+    // should not trigger the lint
+    pub fn new(_: String) -> impl Q<Item = u32, Item2 = Self> {
+        S4
+    }
+}
+
 struct T;
 
 impl T {