From cc663a7b0c1fc813c58be8b8d84772c52f736d26 Mon Sep 17 00:00:00 2001 From: Kirill Bulatov Date: Tue, 19 Jan 2021 00:02:59 +0200 Subject: [PATCH] Consider rustc_deprecated attr when checking for deprecation --- crates/completion/src/render.rs | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/crates/completion/src/render.rs b/crates/completion/src/render.rs index 4b3c9702a44..dbb30d2334d 100644 --- a/crates/completion/src/render.rs +++ b/crates/completion/src/render.rs @@ -87,7 +87,8 @@ fn source_range(&self) -> TextRange { } fn is_deprecated(&self, node: impl HasAttrs) -> bool { - node.attrs(self.db()).by_key("deprecated").exists() + let attrs = node.attrs(self.db()); + attrs.by_key("deprecated").exists() || attrs.by_key("rustc_deprecated").exists() } fn docs(&self, node: impl HasAttrs) -> Option { @@ -485,7 +486,7 @@ fn sets_deprecated_flag_in_items() { r#" #[deprecated] fn something_deprecated() {} -#[deprecated(since = "1.0.0")] +#[rustc_deprecated(since = "1.0.0")] fn something_else_deprecated() {} fn main() { som$0 } @@ -494,8 +495,8 @@ fn main() { som$0 } [ CompletionItem { label: "main()", - source_range: 121..124, - delete: 121..124, + source_range: 127..130, + delete: 127..130, insert: "main()$0", kind: Function, lookup: "main", @@ -503,8 +504,8 @@ fn main() { som$0 } }, CompletionItem { label: "something_deprecated()", - source_range: 121..124, - delete: 121..124, + source_range: 127..130, + delete: 127..130, insert: "something_deprecated()$0", kind: Function, lookup: "something_deprecated", @@ -513,8 +514,8 @@ fn main() { som$0 } }, CompletionItem { label: "something_else_deprecated()", - source_range: 121..124, - delete: 121..124, + source_range: 127..130, + delete: 127..130, insert: "something_else_deprecated()$0", kind: Function, lookup: "something_else_deprecated",