aboutsummaryrefslogtreecommitdiff
path: root/crates/hir_expand/src
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2021-05-06 23:19:52 +0100
committerGitHub <[email protected]>2021-05-06 23:19:52 +0100
commit0ee945e289c438e87d4701401059e8c407710e7b (patch)
tree6b16e28da049a1f627b26eda1a2595a6b3cd84cd /crates/hir_expand/src
parent6fccb152b4646877e38dc29dce1b0cd826eb6908 (diff)
parent90a5dca0a2dbb858ee34eb7de06de8a1cad9e488 (diff)
Merge #8280
8280: Borrow text of immutable syntax node r=iDawer a=iDawer In https://github.com/rust-analyzer/rowan/pull/101 `rowan::SyntaxNode::green` returns `Cow<'_, GreenNodeData>`. It returns borrow of green node of immutable syntax tree node. Using this we can return borrowed text from `ast::Name::text`. ~~However now it allocates in case of mutable syntax trees.~~ (see next comment) The idea comes from https://github.com/rust-analyzer/rowan/pull/100#issuecomment-809330325 Co-authored-by: Dawer <[email protected]>
Diffstat (limited to 'crates/hir_expand/src')
-rw-r--r--crates/hir_expand/src/db.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/crates/hir_expand/src/db.rs b/crates/hir_expand/src/db.rs
index 3e9abd8a1..d61f4b31a 100644
--- a/crates/hir_expand/src/db.rs
+++ b/crates/hir_expand/src/db.rs
@@ -283,7 +283,7 @@ fn macro_arg_text(db: &dyn AstDatabase, id: MacroCallId) -> Option<GreenNode> {
283 }; 283 };
284 let loc = db.lookup_intern_macro(id); 284 let loc = db.lookup_intern_macro(id);
285 let arg = loc.kind.arg(db)?; 285 let arg = loc.kind.arg(db)?;
286 Some(arg.green()) 286 Some(arg.green().into())
287} 287}
288 288
289fn macro_def(db: &dyn AstDatabase, id: MacroDefId) -> Option<Arc<TokenExpander>> { 289fn macro_def(db: &dyn AstDatabase, id: MacroDefId) -> Option<Arc<TokenExpander>> {