From cc663a7b0c1fc813c58be8b8d84772c52f736d26 Mon Sep 17 00:00:00 2001 From: Kirill Bulatov Date: Tue, 19 Jan 2021 00:02:59 +0200 Subject: Consider rustc_deprecated attr when checking for deprecation --- crates/completion/src/render.rs | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'crates') diff --git a/crates/completion/src/render.rs b/crates/completion/src/render.rs index 4b3c9702a..dbb30d233 100644 --- a/crates/completion/src/render.rs +++ b/crates/completion/src/render.rs @@ -87,7 +87,8 @@ impl<'a> RenderContext<'a> { } 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 main() { let _: m::Spam = S$0 } 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", -- cgit v1.2.3