]> git.lizzy.rs Git - rust.git/blobdiff - tests/ui/use_self.fixed
Ignore associated items in trait *implementations* when considering type complexity
[rust.git] / tests / ui / use_self.fixed
index 631da6fe066dde1703ee467b7d7e56a837e44d54..4e33e343ce0e9c414b42abf6d5e73d6b488392c6 100644 (file)
@@ -1,10 +1,14 @@
 // run-rustfix
-// edition:2018
 // aux-build:proc_macro_derive.rs
 
 #![warn(clippy::use_self)]
 #![allow(dead_code)]
-#![allow(clippy::should_implement_trait, clippy::upper_case_acronyms, clippy::from_over_into)]
+#![allow(
+    clippy::should_implement_trait,
+    clippy::upper_case_acronyms,
+    clippy::from_over_into,
+    clippy::self_named_constructors
+)]
 
 #[macro_use]
 extern crate proc_macro_derive;
@@ -492,3 +496,26 @@ mod issue7206 {
         }
     }
 }
+
+mod self_is_ty_param {
+    trait Trait {
+        type Type;
+        type Hi;
+
+        fn test();
+    }
+
+    impl<I> Trait for I
+    where
+        I: Iterator,
+        I::Item: Trait, // changing this to Self would require <Self as Iterator>
+    {
+        type Type = I;
+        type Hi = I::Item;
+
+        fn test() {
+            let _: I::Item;
+            let _: I; // this could lint, but is questionable
+        }
+    }
+}