From 9231821c031ddada08d37547664b276d5e631f62 Mon Sep 17 00:00:00 2001 From: Jonas Schievink Date: Thu, 17 Dec 2020 15:45:26 +0100 Subject: Make `Attrs::from_attrs_owner` private --- crates/ide/src/display/navigation_target.rs | 30 ++--------------------------- 1 file changed, 2 insertions(+), 28 deletions(-) (limited to 'crates/ide/src/display/navigation_target.rs') diff --git a/crates/ide/src/display/navigation_target.rs b/crates/ide/src/display/navigation_target.rs index 54b33a98e..8410bf5a2 100644 --- a/crates/ide/src/display/navigation_target.rs +++ b/crates/ide/src/display/navigation_target.rs @@ -1,9 +1,7 @@ //! FIXME: write short doc here use either::Either; -use hir::{ - AssocItem, Documentation, FieldSource, HasAttrs, HasSource, HirFileId, InFile, ModuleSource, -}; +use hir::{AssocItem, Documentation, FieldSource, HasAttrs, HasSource, InFile, ModuleSource}; use ide_db::base_db::{FileId, SourceDatabase}; use ide_db::{defs::Definition, RootDatabase}; use syntax::{ @@ -168,7 +166,7 @@ impl ToNav for FileSymbol { focus_range: self.name_range, container_name: self.container_name.clone(), description: description_from_symbol(db, self), - docs: docs_from_symbol(db, self), + docs: None, } } } @@ -394,30 +392,6 @@ impl ToNav for hir::LifetimeParam { } } -pub(crate) fn docs_from_symbol(db: &RootDatabase, symbol: &FileSymbol) -> Option { - let parse = db.parse(symbol.file_id); - let node = symbol.ptr.to_node(parse.tree().syntax()); - let file_id = HirFileId::from(symbol.file_id); - - let it = match_ast! { - match node { - ast::Fn(it) => hir::Attrs::from_attrs_owner(db, InFile::new(file_id, &it)), - ast::Struct(it) => hir::Attrs::from_attrs_owner(db, InFile::new(file_id, &it)), - ast::Enum(it) => hir::Attrs::from_attrs_owner(db, InFile::new(file_id, &it)), - ast::Trait(it) => hir::Attrs::from_attrs_owner(db, InFile::new(file_id, &it)), - ast::Module(it) => hir::Attrs::from_attrs_owner(db, InFile::new(file_id, &it)), - ast::TypeAlias(it) => hir::Attrs::from_attrs_owner(db, InFile::new(file_id, &it)), - ast::Const(it) => hir::Attrs::from_attrs_owner(db, InFile::new(file_id, &it)), - ast::Static(it) => hir::Attrs::from_attrs_owner(db, InFile::new(file_id, &it)), - ast::RecordField(it) => hir::Attrs::from_attrs_owner(db, InFile::new(file_id, &it)), - ast::Variant(it) => hir::Attrs::from_attrs_owner(db, InFile::new(file_id, &it)), - ast::MacroCall(it) => hir::Attrs::from_attrs_owner(db, InFile::new(file_id, &it)), - _ => return None, - } - }; - it.docs() -} - /// Get a description of a symbol. /// /// e.g. `struct Name`, `enum Name`, `fn Name` -- cgit v1.2.3