]> git.lizzy.rs Git - rust.git/blobdiff - tests/ui/use_self.rs
Auto merge of #3603 - xfix:random-state-lint, r=phansch
[rust.git] / tests / ui / use_self.rs
index c21df403035f78481abec9fb9ea1b9fac4c27fbc..b201e160ebd93e2ac2555372f82442c84afd60f2 100644 (file)
@@ -51,8 +51,6 @@ fn default() -> Self {
     }
 }
 
-//todo the lint does not handle lifetimed struct
-//the following module should trigger the lint on the third method only
 mod lifetimes {
     struct Foo<'a> {
         foo_str: &'a str,
@@ -69,7 +67,8 @@ fn bar() -> Foo<'static> {
             Foo { foo_str: "foo" }
         }
 
-        // `Self` is applicable here
+        // FIXME: the lint does not handle lifetimed struct
+        // `Self` should be applicable here
         fn clone(&self) -> Foo<'a> {
             Foo { foo_str: self.foo_str }
         }
@@ -217,6 +216,16 @@ fn good(foos: &[Self]) -> impl Iterator<Item = &Self> {
     }
 }
 
+mod tuple_structs {
+    pub struct TS(i32);
+
+    impl TS {
+        pub fn ts() -> Self {
+            TS(0)
+        }
+    }
+}
+
 mod issue3410 {
 
     struct A;