From e42f9627664cc3c44094e1c4f985270fbfd592b1 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Fri, 22 Nov 2019 11:27:47 +0300 Subject: Encapsulate Attrs --- crates/ra_ide_api/src/completion/presentation.rs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'crates/ra_ide_api/src/completion') diff --git a/crates/ra_ide_api/src/completion/presentation.rs b/crates/ra_ide_api/src/completion/presentation.rs index b20329459..cbaf169bf 100644 --- a/crates/ra_ide_api/src/completion/presentation.rs +++ b/crates/ra_ide_api/src/completion/presentation.rs @@ -286,10 +286,7 @@ impl Completions { } fn is_deprecated(node: impl Attrs, db: &impl HirDatabase) -> bool { - match node.attrs(db) { - None => false, - Some(attrs) => attrs.iter().any(|x| x.is_simple_atom("deprecated")), - } + node.attrs(db).has_atom("deprecated") } fn has_non_default_type_params(def: hir::GenericDef, db: &db::RootDatabase) -> bool { -- cgit v1.2.3 From a87e9145a67634a5ea8a893ab8b52b3c07108a13 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Fri, 22 Nov 2019 11:36:14 +0300 Subject: Rename Atts trait --- crates/ra_ide_api/src/completion/presentation.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'crates/ra_ide_api/src/completion') diff --git a/crates/ra_ide_api/src/completion/presentation.rs b/crates/ra_ide_api/src/completion/presentation.rs index cbaf169bf..bd464d193 100644 --- a/crates/ra_ide_api/src/completion/presentation.rs +++ b/crates/ra_ide_api/src/completion/presentation.rs @@ -1,6 +1,6 @@ //! This modules takes care of rendering various definitions as completion items. -use hir::{db::HirDatabase, Attrs, Docs, HasSource, HirDisplay, ScopeDef, Ty, TypeWalk}; +use hir::{db::HirDatabase, Docs, HasAttrs, HasSource, HirDisplay, ScopeDef, Ty, TypeWalk}; use join_to_string::join; use ra_syntax::ast::NameOwner; use test_utils::tested_by; @@ -285,7 +285,7 @@ impl Completions { } } -fn is_deprecated(node: impl Attrs, db: &impl HirDatabase) -> bool { +fn is_deprecated(node: impl HasAttrs, db: &impl HirDatabase) -> bool { node.attrs(db).has_atom("deprecated") } -- cgit v1.2.3