diff options
Diffstat (limited to 'crates/ra_assists/src/handlers/auto_import.rs')
-rw-r--r-- | crates/ra_assists/src/handlers/auto_import.rs | 92 |
1 files changed, 47 insertions, 45 deletions
diff --git a/crates/ra_assists/src/handlers/auto_import.rs b/crates/ra_assists/src/handlers/auto_import.rs index 5092bf336..d1cafa7d9 100644 --- a/crates/ra_assists/src/handlers/auto_import.rs +++ b/crates/ra_assists/src/handlers/auto_import.rs | |||
@@ -488,16 +488,17 @@ mod tests { | |||
488 | check_assist( | 488 | check_assist( |
489 | auto_import, | 489 | auto_import, |
490 | r" | 490 | r" |
491 | //- /lib.rs crate:crate_with_macro | 491 | //- /lib.rs crate:crate_with_macro |
492 | #[macro_export] | 492 | #[macro_export] |
493 | macro_rules! foo { | 493 | macro_rules! foo { |
494 | () => () | 494 | () => () |
495 | } | 495 | } |
496 | 496 | ||
497 | //- /main.rs crate:main deps:crate_with_macro | 497 | //- /main.rs crate:main deps:crate_with_macro |
498 | fn main() { | 498 | fn main() { |
499 | foo<|> | 499 | foo<|> |
500 | }", | 500 | } |
501 | ", | ||
501 | r"use crate_with_macro::foo; | 502 | r"use crate_with_macro::foo; |
502 | 503 | ||
503 | fn main() { | 504 | fn main() { |
@@ -847,13 +848,14 @@ fn main() { | |||
847 | check_assist( | 848 | check_assist( |
848 | auto_import, | 849 | auto_import, |
849 | r" | 850 | r" |
850 | //- /lib.rs crate:dep | 851 | //- /lib.rs crate:dep |
851 | pub struct Struct; | 852 | pub struct Struct; |
852 | 853 | ||
853 | //- /main.rs crate:main deps:dep | 854 | //- /main.rs crate:main deps:dep |
854 | fn main() { | 855 | fn main() { |
855 | Struct<|> | 856 | Struct<|> |
856 | }", | 857 | } |
858 | ", | ||
857 | r"use dep::Struct; | 859 | r"use dep::Struct; |
858 | 860 | ||
859 | fn main() { | 861 | fn main() { |
@@ -869,20 +871,22 @@ fn main() { | |||
869 | check_assist( | 871 | check_assist( |
870 | auto_import, | 872 | auto_import, |
871 | r" | 873 | r" |
872 | //- /lib.rs crate:dep | 874 | //- /lib.rs crate:dep |
873 | pub mod fmt { | 875 | pub mod fmt { |
874 | pub trait Display {} | 876 | pub trait Display {} |
875 | } | 877 | } |
876 | 878 | ||
877 | pub fn panic_fmt() {} | 879 | pub fn panic_fmt() {} |
878 | 880 | ||
879 | //- /main.rs crate:main deps:dep | 881 | //- /main.rs crate:main deps:dep |
880 | struct S; | 882 | struct S; |
881 | 883 | ||
882 | impl f<|>mt::Display for S {}", | 884 | impl f<|>mt::Display for S {} |
885 | ", | ||
883 | r"use dep::fmt; | 886 | r"use dep::fmt; |
884 | 887 | ||
885 | struct S; | 888 | struct S; |
889 | |||
886 | impl fmt::Display for S {} | 890 | impl fmt::Display for S {} |
887 | ", | 891 | ", |
888 | ); | 892 | ); |
@@ -894,21 +898,20 @@ impl fmt::Display for S {} | |||
894 | check_assist( | 898 | check_assist( |
895 | auto_import, | 899 | auto_import, |
896 | r" | 900 | r" |
897 | //- /lib.rs crate:dep | 901 | //- /lib.rs crate:dep |
898 | 902 | macro_rules! mac { | |
899 | macro_rules! mac { | 903 | () => { |
900 | () => { | 904 | pub struct Cheese; |
901 | pub struct Cheese; | 905 | }; |
902 | }; | 906 | } |
903 | } | ||
904 | |||
905 | mac!(); | ||
906 | 907 | ||
907 | //- /main.rs crate:main deps:dep | 908 | mac!(); |
908 | 909 | ||
909 | fn main() { | 910 | //- /main.rs crate:main deps:dep |
910 | Cheese<|>; | 911 | fn main() { |
911 | }", | 912 | Cheese<|>; |
913 | } | ||
914 | ", | ||
912 | r"use dep::Cheese; | 915 | r"use dep::Cheese; |
913 | 916 | ||
914 | fn main() { | 917 | fn main() { |
@@ -924,16 +927,15 @@ fn main() { | |||
924 | check_assist( | 927 | check_assist( |
925 | auto_import, | 928 | auto_import, |
926 | r" | 929 | r" |
927 | //- /lib.rs crate:dep | 930 | //- /lib.rs crate:dep |
928 | 931 | pub struct FMT; | |
929 | pub struct FMT; | 932 | pub struct fmt; |
930 | pub struct fmt; | ||
931 | |||
932 | //- /main.rs crate:main deps:dep | ||
933 | 933 | ||
934 | fn main() { | 934 | //- /main.rs crate:main deps:dep |
935 | FMT<|>; | 935 | fn main() { |
936 | }", | 936 | FMT<|>; |
937 | } | ||
938 | ", | ||
937 | r"use dep::FMT; | 939 | r"use dep::FMT; |
938 | 940 | ||
939 | fn main() { | 941 | fn main() { |