From 5a4b4f507e9b90bfe41b451763868cba0a70c392 Mon Sep 17 00:00:00 2001 From: uHOOCCOOHu Date: Mon, 30 Sep 2019 05:15:03 +0800 Subject: Fix API of Attr --- crates/ra_hir/src/lang_item.rs | 2 +- crates/ra_hir/src/nameres/raw.rs | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) (limited to 'crates/ra_hir/src') diff --git a/crates/ra_hir/src/lang_item.rs b/crates/ra_hir/src/lang_item.rs index bcce314d8..dbba433fe 100644 --- a/crates/ra_hir/src/lang_item.rs +++ b/crates/ra_hir/src/lang_item.rs @@ -151,7 +151,7 @@ impl LangItems { fn lang_item_name(node: &T) -> Option { node.attrs() - .filter_map(|a| a.as_key_value()) + .filter_map(|a| a.as_simple_key_value()) .filter(|(key, _)| key == "lang") .map(|(_, val)| val) .nth(0) diff --git a/crates/ra_hir/src/nameres/raw.rs b/crates/ra_hir/src/nameres/raw.rs index c494b95b0..0e27dd2db 100644 --- a/crates/ra_hir/src/nameres/raw.rs +++ b/crates/ra_hir/src/nameres/raw.rs @@ -353,8 +353,7 @@ impl RawItemsCollector<&DB> { let name = m.name().map(|it| it.as_name()); let ast_id = self.source_ast_id_map.ast_id(&m); - let export = m.has_atom_attr("macro_export") - || m.attrs().filter_map(|x| x.as_call()).any(|(name, _)| name == "macro_export"); + let export = m.attrs().filter_map(|x| x.simple_name()).any(|name| name == "macro_export"); let m = self.raw_items.macros.alloc(MacroData { ast_id, path, name, export }); self.push_item(current_module, RawItem::Macro(m)); @@ -385,7 +384,7 @@ impl RawItemsCollector<&DB> { fn extract_mod_path_attribute(module: &ast::Module) -> Option { module.attrs().into_iter().find_map(|attr| { - attr.as_key_value().and_then(|(name, value)| { + attr.as_simple_key_value().and_then(|(name, value)| { let is_path = name == "path"; if is_path { Some(value) -- cgit v1.2.3