]> git.lizzy.rs Git - rust.git/commitdiff
Fix incorrect prefer_inner calls on some attribute completions
authorLukas Wirth <lukastw97@gmail.com>
Sun, 30 May 2021 15:10:42 +0000 (17:10 +0200)
committerLukas Wirth <lukastw97@gmail.com>
Sun, 30 May 2021 15:13:00 +0000 (17:13 +0200)
crates/ide_completion/src/completions/attribute.rs

index 13d5b90c99ec82080c5bc0d397f650e3380c5970..76d926157c08746318e339435154f0f08c6ef776 100644 (file)
@@ -219,8 +219,7 @@ macro_rules! attrs {
     ),
     attr("feature(…)", Some("feature"), Some("feature(${0:flag})")).prefer_inner(),
     attr("forbid(…)", Some("forbid"), Some("forbid(${0:lint})")),
-    // FIXME: resolve through macro resolution?
-    attr("global_allocator", None, None).prefer_inner(),
+    attr("global_allocator", None, None),
     attr(r#"ignore = "…""#, Some("ignore"), Some(r#"ignore = "${0:reason}""#)),
     attr("inline", Some("inline"), Some("inline")),
     attr("link", None, None),
@@ -239,7 +238,7 @@ macro_rules! attrs {
     attr("no_mangle", None, None),
     attr("no_std", None, None).prefer_inner(),
     attr("non_exhaustive", None, None),
-    attr("panic_handler", None, None).prefer_inner(),
+    attr("panic_handler", None, None),
     attr(r#"path = "…""#, Some("path"), Some(r#"path ="${0:path}""#)),
     attr("proc_macro", None, None),
     attr("proc_macro_attribute", None, None),
@@ -609,6 +608,7 @@ fn complete_attribute_on_static() {
                 at export_name = "…"
                 at link_name = "…"
                 at link_section = "…"
+                at global_allocator
                 at used
             "#]],
         );
@@ -732,9 +732,9 @@ fn complete_attribute_on_variant() {
     }
 
     #[test]
-    fn complete_attribute_on_expr() {
+    fn complete_attribute_on_fn() {
         check(
-            r#"fn main() { #[$0] foo() }"#,
+            r#"#[$0] fn main() {}"#,
             expect![[r#"
                 at allow(…)
                 at cfg(…)
@@ -742,10 +742,35 @@ fn complete_attribute_on_expr() {
                 at deny(…)
                 at forbid(…)
                 at warn(…)
+                at deprecated
+                at doc = "…"
+                at doc(hidden)
+                at doc(alias = "…")
+                at must_use
+                at no_mangle
+                at export_name = "…"
+                at link_name = "…"
+                at link_section = "…"
+                at cold
+                at ignore = "…"
+                at inline
+                at must_use
+                at panic_handler
+                at proc_macro
+                at proc_macro_derive(…)
+                at proc_macro_attribute
+                at should_panic
+                at target_feature = "…"
+                at test
+                at track_caller
             "#]],
         );
+    }
+
+    #[test]
+    fn complete_attribute_on_expr() {
         check(
-            r#"fn main() { #[$0] foo(); }"#,
+            r#"fn main() { #[$0] foo() }"#,
             expect![[r#"
                 at allow(…)
                 at cfg(…)