aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--crates/ra_hir_expand/src/lib.rs4
-rw-r--r--crates/ra_mbe/src/syntax_bridge.rs2
-rw-r--r--crates/ra_mbe/src/tests.rs2
3 files changed, 4 insertions, 4 deletions
diff --git a/crates/ra_hir_expand/src/lib.rs b/crates/ra_hir_expand/src/lib.rs
index 720a29ea5..2fa5d5140 100644
--- a/crates/ra_hir_expand/src/lib.rs
+++ b/crates/ra_hir_expand/src/lib.rs
@@ -227,7 +227,7 @@ impl ExpansionInfo {
227 let token_id = self.macro_arg.1.token_by_range(range)?; 227 let token_id = self.macro_arg.1.token_by_range(range)?;
228 let token_id = self.macro_def.0.map_id_down(token_id); 228 let token_id = self.macro_def.0.map_id_down(token_id);
229 229
230 let range = self.exp_map.range_by_token(token_id)?.range(token.value.kind())?; 230 let range = self.exp_map.range_by_token(token_id)?.by_kind(token.value.kind())?;
231 231
232 let token = algo::find_covering_element(&self.expanded.value, range).into_token()?; 232 let token = algo::find_covering_element(&self.expanded.value, range).into_token()?;
233 233
@@ -248,7 +248,7 @@ impl ExpansionInfo {
248 } 248 }
249 }; 249 };
250 250
251 let range = token_map.range_by_token(token_id)?.range(token.value.kind())?; 251 let range = token_map.range_by_token(token_id)?.by_kind(token.value.kind())?;
252 let token = algo::find_covering_element(&tt.value, range + tt.value.text_range().start()) 252 let token = algo::find_covering_element(&tt.value, range + tt.value.text_range().start())
253 .into_token()?; 253 .into_token()?;
254 Some((tt.with_value(token), origin)) 254 Some((tt.with_value(token), origin))
diff --git a/crates/ra_mbe/src/syntax_bridge.rs b/crates/ra_mbe/src/syntax_bridge.rs
index 44a51b7a5..d585d57af 100644
--- a/crates/ra_mbe/src/syntax_bridge.rs
+++ b/crates/ra_mbe/src/syntax_bridge.rs
@@ -19,7 +19,7 @@ pub enum TokenTextRange {
19} 19}
20 20
21impl TokenTextRange { 21impl TokenTextRange {
22 pub fn range(self, kind: SyntaxKind) -> Option<TextRange> { 22 pub fn by_kind(self, kind: SyntaxKind) -> Option<TextRange> {
23 match self { 23 match self {
24 TokenTextRange::Token(it) => Some(it), 24 TokenTextRange::Token(it) => Some(it),
25 TokenTextRange::Delimiter(open, close) => match kind { 25 TokenTextRange::Delimiter(open, close) => match kind {
diff --git a/crates/ra_mbe/src/tests.rs b/crates/ra_mbe/src/tests.rs
index ae7f3dfd4..ff225f0db 100644
--- a/crates/ra_mbe/src/tests.rs
+++ b/crates/ra_mbe/src/tests.rs
@@ -102,7 +102,7 @@ macro_rules! foobar {
102 let (expansion, (token_map, content)) = expand_and_map(&rules, "foobar!(baz);"); 102 let (expansion, (token_map, content)) = expand_and_map(&rules, "foobar!(baz);");
103 103
104 let get_text = |id, kind| -> String { 104 let get_text = |id, kind| -> String {
105 content[token_map.range_by_token(id).unwrap().range(kind).unwrap()].to_string() 105 content[token_map.range_by_token(id).unwrap().by_kind(kind).unwrap()].to_string()
106 }; 106 };
107 107
108 assert_eq!(expansion.token_trees.len(), 4); 108 assert_eq!(expansion.token_trees.len(), 4);