diff options
Diffstat (limited to 'crates/ide_assists')
-rw-r--r-- | crates/ide_assists/src/handlers/fix_visibility.rs | 2 | ||||
-rw-r--r-- | crates/ide_assists/src/handlers/generate_function.rs | 49 |
2 files changed, 16 insertions, 35 deletions
diff --git a/crates/ide_assists/src/handlers/fix_visibility.rs b/crates/ide_assists/src/handlers/fix_visibility.rs index 2f2b605fc..f834bf16a 100644 --- a/crates/ide_assists/src/handlers/fix_visibility.rs +++ b/crates/ide_assists/src/handlers/fix_visibility.rs | |||
@@ -361,8 +361,6 @@ pub struct Foo { pub bar: () } | |||
361 | } | 361 | } |
362 | 362 | ||
363 | #[test] | 363 | #[test] |
364 | #[ignore] | ||
365 | // FIXME reenable this test when `Semantics::resolve_record_field` works with union fields | ||
366 | fn fix_visibility_of_union_field() { | 364 | fn fix_visibility_of_union_field() { |
367 | check_assist( | 365 | check_assist( |
368 | fix_visibility, | 366 | fix_visibility, |
diff --git a/crates/ide_assists/src/handlers/generate_function.rs b/crates/ide_assists/src/handlers/generate_function.rs index 706c995ac..6a658d4cf 100644 --- a/crates/ide_assists/src/handlers/generate_function.rs +++ b/crates/ide_assists/src/handlers/generate_function.rs | |||
@@ -811,9 +811,8 @@ fn bar(baz: Baz::Bof) ${0:-> ()} { | |||
811 | } | 811 | } |
812 | 812 | ||
813 | #[test] | 813 | #[test] |
814 | #[ignore] | ||
815 | // FIXME fix printing the generics of a `Ty` to make this test pass | ||
816 | fn add_function_with_generic_arg() { | 814 | fn add_function_with_generic_arg() { |
815 | // FIXME: This is wrong, generated `bar` should include generic parameter. | ||
817 | check_assist( | 816 | check_assist( |
818 | generate_function, | 817 | generate_function, |
819 | r" | 818 | r" |
@@ -826,7 +825,7 @@ fn foo<T>(t: T) { | |||
826 | bar(t) | 825 | bar(t) |
827 | } | 826 | } |
828 | 827 | ||
829 | fn bar<T>(t: T) ${0:-> ()} { | 828 | fn bar(t: T) ${0:-> ()} { |
830 | todo!() | 829 | todo!() |
831 | } | 830 | } |
832 | ", | 831 | ", |
@@ -834,9 +833,8 @@ fn bar<T>(t: T) ${0:-> ()} { | |||
834 | } | 833 | } |
835 | 834 | ||
836 | #[test] | 835 | #[test] |
837 | #[ignore] | ||
838 | // FIXME Fix function type printing to make this test pass | ||
839 | fn add_function_with_fn_arg() { | 836 | fn add_function_with_fn_arg() { |
837 | // FIXME: The argument in `bar` is wrong. | ||
840 | check_assist( | 838 | check_assist( |
841 | generate_function, | 839 | generate_function, |
842 | r" | 840 | r" |
@@ -857,7 +855,7 @@ fn foo() { | |||
857 | bar(Baz::new); | 855 | bar(Baz::new); |
858 | } | 856 | } |
859 | 857 | ||
860 | fn bar(arg: fn() -> Baz) ${0:-> ()} { | 858 | fn bar(new: fn) ${0:-> ()} { |
861 | todo!() | 859 | todo!() |
862 | } | 860 | } |
863 | ", | 861 | ", |
@@ -865,9 +863,8 @@ fn bar(arg: fn() -> Baz) ${0:-> ()} { | |||
865 | } | 863 | } |
866 | 864 | ||
867 | #[test] | 865 | #[test] |
868 | #[ignore] | ||
869 | // FIXME Fix closure type printing to make this test pass | ||
870 | fn add_function_with_closure_arg() { | 866 | fn add_function_with_closure_arg() { |
867 | // FIXME: The argument in `bar` is wrong. | ||
871 | check_assist( | 868 | check_assist( |
872 | generate_function, | 869 | generate_function, |
873 | r" | 870 | r" |
@@ -882,7 +879,7 @@ fn foo() { | |||
882 | bar(closure) | 879 | bar(closure) |
883 | } | 880 | } |
884 | 881 | ||
885 | fn bar(closure: impl Fn(i64) -> i64) ${0:-> ()} { | 882 | fn bar(closure: ()) ${0:-> ()} { |
886 | todo!() | 883 | todo!() |
887 | } | 884 | } |
888 | ", | 885 | ", |
@@ -986,13 +983,10 @@ fn foo() { | |||
986 | } | 983 | } |
987 | 984 | ||
988 | #[test] | 985 | #[test] |
989 | #[ignore] | ||
990 | // Ignored until local imports are supported. | ||
991 | // See https://github.com/rust-analyzer/rust-analyzer/issues/1165 | ||
992 | fn qualified_path_uses_correct_scope() { | 986 | fn qualified_path_uses_correct_scope() { |
993 | check_assist( | 987 | check_assist( |
994 | generate_function, | 988 | generate_function, |
995 | " | 989 | r#" |
996 | mod foo { | 990 | mod foo { |
997 | pub struct Foo; | 991 | pub struct Foo; |
998 | } | 992 | } |
@@ -1001,8 +995,8 @@ fn bar() { | |||
1001 | let foo = Foo; | 995 | let foo = Foo; |
1002 | baz$0(foo) | 996 | baz$0(foo) |
1003 | } | 997 | } |
1004 | ", | 998 | "#, |
1005 | " | 999 | r#" |
1006 | mod foo { | 1000 | mod foo { |
1007 | pub struct Foo; | 1001 | pub struct Foo; |
1008 | } | 1002 | } |
@@ -1015,7 +1009,7 @@ fn bar() { | |||
1015 | fn baz(foo: foo::Foo) ${0:-> ()} { | 1009 | fn baz(foo: foo::Foo) ${0:-> ()} { |
1016 | todo!() | 1010 | todo!() |
1017 | } | 1011 | } |
1018 | ", | 1012 | "#, |
1019 | ) | 1013 | ) |
1020 | } | 1014 | } |
1021 | 1015 | ||
@@ -1141,40 +1135,29 @@ fn bar() {} | |||
1141 | // The assist is only active if the cursor is on an unresolved path, | 1135 | // The assist is only active if the cursor is on an unresolved path, |
1142 | // but the assist should only be offered if the path is a function call. | 1136 | // but the assist should only be offered if the path is a function call. |
1143 | generate_function, | 1137 | generate_function, |
1144 | r" | 1138 | r#" |
1145 | fn foo() { | 1139 | fn foo() { |
1146 | bar(b$0az); | 1140 | bar(b$0az); |
1147 | } | 1141 | } |
1148 | 1142 | ||
1149 | fn bar(baz: ()) {} | 1143 | fn bar(baz: ()) {} |
1150 | ", | 1144 | "#, |
1151 | ) | 1145 | ) |
1152 | } | 1146 | } |
1153 | 1147 | ||
1154 | #[test] | 1148 | #[test] |
1155 | #[ignore] | ||
1156 | fn create_method_with_no_args() { | 1149 | fn create_method_with_no_args() { |
1157 | check_assist( | 1150 | // FIXME: This is wrong, this should just work. |
1151 | check_assist_not_applicable( | ||
1158 | generate_function, | 1152 | generate_function, |
1159 | r" | 1153 | r#" |
1160 | struct Foo; | 1154 | struct Foo; |
1161 | impl Foo { | 1155 | impl Foo { |
1162 | fn foo(&self) { | 1156 | fn foo(&self) { |
1163 | self.bar()$0; | 1157 | self.bar()$0; |
1164 | } | 1158 | } |
1165 | } | 1159 | } |
1166 | ", | 1160 | "#, |
1167 | r" | ||
1168 | struct Foo; | ||
1169 | impl Foo { | ||
1170 | fn foo(&self) { | ||
1171 | self.bar(); | ||
1172 | } | ||
1173 | fn bar(&self) { | ||
1174 | todo!(); | ||
1175 | } | ||
1176 | } | ||
1177 | ", | ||
1178 | ) | 1161 | ) |
1179 | } | 1162 | } |
1180 | } | 1163 | } |