aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2019-07-19 18:57:33 +0100
committerbors[bot] <26634292+bors[bot]@users.noreply.github.com>2019-07-19 18:57:33 +0100
commitfabd4c4304e387ed6bcc29b39d1593666c4cbec9 (patch)
treeb18a0be7255bb070dd7e2ae3b5687bc5f35f0d41 /crates/ra_hir
parentd4ffbf2ae092b313b3c750adad398f3aa6fb209b (diff)
parent002529937075bd69d7f71483d798d6e4f43d1de9 (diff)
Merge #1556
1556: sane indexing in text r=matklad a=matklad Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'crates/ra_hir')
-rw-r--r--crates/ra_hir/src/ids.rs11
1 files changed, 10 insertions, 1 deletions
diff --git a/crates/ra_hir/src/ids.rs b/crates/ra_hir/src/ids.rs
index 05a18eb56..ec756f2c3 100644
--- a/crates/ra_hir/src/ids.rs
+++ b/crates/ra_hir/src/ids.rs
@@ -362,7 +362,16 @@ impl MacroCallId {
362 pub fn debug_dump(self, db: &impl AstDatabase) -> String { 362 pub fn debug_dump(self, db: &impl AstDatabase) -> String {
363 let loc = self.loc(db); 363 let loc = self.loc(db);
364 let node = loc.ast_id.to_node(db); 364 let node = loc.ast_id.to_node(db);
365 let syntax_str = node.syntax().text().chunks().collect::<Vec<_>>().join(" "); 365 let syntax_str = {
366 let mut res = String::new();
367 node.syntax().text().for_each_chunk(|chunk| {
368 if !res.is_empty() {
369 res.push(' ')
370 }
371 res.push_str(chunk)
372 });
373 res
374 };
366 375
367 // dump the file name 376 // dump the file name
368 let file_id: HirFileId = self.loc(db).ast_id.file_id(); 377 let file_id: HirFileId = self.loc(db).ast_id.file_id();