Skip to content

Commit f1d163b

Browse files
bors[bot]Veykril
andauthored
9064: Fix incorrect prefer_inner calls on some attribute completions r=Veykril a=Veykril bors r+ Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2 parents f41b686 + c5cd25d commit f1d163b

File tree

1 file changed

+31
-6
lines changed

1 file changed

+31
-6
lines changed

crates/ide_completion/src/completions/attribute.rs

Lines changed: 31 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -219,8 +219,7 @@ const ATTRIBUTES: &[AttrCompletion] = &[
219219
),
220220
attr("feature(…)", Some("feature"), Some("feature(${0:flag})")).prefer_inner(),
221221
attr("forbid(…)", Some("forbid"), Some("forbid(${0:lint})")),
222-
// FIXME: resolve through macro resolution?
223-
attr("global_allocator", None, None).prefer_inner(),
222+
attr("global_allocator", None, None),
224223
attr(r#"ignore = "…""#, Some("ignore"), Some(r#"ignore = "${0:reason}""#)),
225224
attr("inline", Some("inline"), Some("inline")),
226225
attr("link", None, None),
@@ -239,7 +238,7 @@ const ATTRIBUTES: &[AttrCompletion] = &[
239238
attr("no_mangle", None, None),
240239
attr("no_std", None, None).prefer_inner(),
241240
attr("non_exhaustive", None, None),
242-
attr("panic_handler", None, None).prefer_inner(),
241+
attr("panic_handler", None, None),
243242
attr(r#"path = "…""#, Some("path"), Some(r#"path ="${0:path}""#)),
244243
attr("proc_macro", None, None),
245244
attr("proc_macro_attribute", None, None),
@@ -609,6 +608,7 @@ mod tests {
609608
at export_name = "…"
610609
at link_name = "…"
611610
at link_section = "…"
611+
at global_allocator
612612
at used
613613
"#]],
614614
);
@@ -732,20 +732,45 @@ mod tests {
732732
}
733733

734734
#[test]
735-
fn complete_attribute_on_expr() {
735+
fn complete_attribute_on_fn() {
736736
check(
737-
r#"fn main() { #[$0] foo() }"#,
737+
r#"#[$0] fn main() {}"#,
738738
expect![[r#"
739739
at allow(…)
740740
at cfg(…)
741741
at cfg_attr(…)
742742
at deny(…)
743743
at forbid(…)
744744
at warn(…)
745+
at deprecated
746+
at doc = "…"
747+
at doc(hidden)
748+
at doc(alias = "…")
749+
at must_use
750+
at no_mangle
751+
at export_name = "…"
752+
at link_name = "…"
753+
at link_section = "…"
754+
at cold
755+
at ignore = "…"
756+
at inline
757+
at must_use
758+
at panic_handler
759+
at proc_macro
760+
at proc_macro_derive(…)
761+
at proc_macro_attribute
762+
at should_panic
763+
at target_feature = "…"
764+
at test
765+
at track_caller
745766
"#]],
746767
);
768+
}
769+
770+
#[test]
771+
fn complete_attribute_on_expr() {
747772
check(
748-
r#"fn main() { #[$0] foo(); }"#,
773+
r#"fn main() { #[$0] foo() }"#,
749774
expect![[r#"
750775
at allow(…)
751776
at cfg(…)

0 commit comments

Comments
 (0)