From a3472f8fe16a359f9ea7a12e7b4920894921421e Mon Sep 17 00:00:00 2001 From: "Jeremy A. Kolb" Date: Tue, 22 Jan 2019 18:20:40 -0500 Subject: Move label from hir to ide_api --- crates/ra_hir/src/code_model_api.rs | 22 ---------------------- 1 file changed, 22 deletions(-) (limited to 'crates/ra_hir') diff --git a/crates/ra_hir/src/code_model_api.rs b/crates/ra_hir/src/code_model_api.rs index 21ca36265..9ae620efd 100644 --- a/crates/ra_hir/src/code_model_api.rs +++ b/crates/ra_hir/src/code_model_api.rs @@ -366,28 +366,6 @@ impl Function { Some(comments) } } - - pub fn label(&self, db: &impl HirDatabase) -> Option { - let def_loc = self.def_id.loc(db); - let syntax = db.file_item(def_loc.source_item_id); - let node = ast::FnDef::cast(&syntax).expect("fn def should point to FnDef node"); - - let label: String = if let Some(body) = node.body() { - let body_range = body.syntax().range(); - let label: String = node - .syntax() - .children() - .filter(|child| !child.range().is_subrange(&body_range)) // Filter out body - .filter(|child| ast::Comment::cast(child).is_none()) // Filter out comments - .map(|node| node.text().to_string()) - .collect(); - label - } else { - node.syntax().text().to_string() - }; - - Some(label.trim().to_owned()) - } } #[derive(Debug, Clone, PartialEq, Eq, Hash)] -- cgit v1.2.3