]> git.lizzy.rs Git - rust.git/commitdiff
Add autoimport test with inner items
authorJonas Schievink <jonasschievink@gmail.com>
Mon, 19 Apr 2021 17:53:29 +0000 (19:53 +0200)
committerJonas Schievink <jonasschievink@gmail.com>
Mon, 19 Apr 2021 17:53:29 +0000 (19:53 +0200)
crates/ide_assists/src/handlers/auto_import.rs

index 5ccd7f7a2c63c1d9742cc608d5c6901ca93f2a9b..49aa70f74e77cec079a89f1e439aeb7ba25941b0 100644 (file)
@@ -934,4 +934,37 @@ fn main() {
 ",
         );
     }
+
+    #[test]
+    fn inner_items() {
+        check_assist(
+            auto_import,
+            r#"
+mod baz {
+    pub struct Foo {}
+}
+
+mod bar {
+    fn bar() {
+        Foo$0;
+        println!("Hallo");
+    }
+}
+"#,
+            r#"
+mod baz {
+    pub struct Foo {}
+}
+
+mod bar {
+    use crate::baz::Foo;
+
+    fn bar() {
+        Foo;
+        println!("Hallo");
+    }
+}
+"#,
+        );
+    }
 }