diff options
Diffstat (limited to 'crates/hir_expand')
-rw-r--r-- | crates/hir_expand/src/db.rs | 2 | ||||
-rw-r--r-- | crates/hir_expand/src/lib.rs | 8 |
2 files changed, 5 insertions, 5 deletions
diff --git a/crates/hir_expand/src/db.rs b/crates/hir_expand/src/db.rs index c62086390..467516eb7 100644 --- a/crates/hir_expand/src/db.rs +++ b/crates/hir_expand/src/db.rs | |||
@@ -118,7 +118,7 @@ pub fn expand_hypothetical( | |||
118 | parse_macro_with_arg(db, macro_file, Some(std::sync::Arc::new((tt, tmap_1)))).value?; | 118 | parse_macro_with_arg(db, macro_file, Some(std::sync::Arc::new((tt, tmap_1)))).value?; |
119 | let token_id = macro_def.0.map_id_down(token_id); | 119 | let token_id = macro_def.0.map_id_down(token_id); |
120 | let range = tmap_2.range_by_token(token_id)?.by_kind(token_to_map.kind())?; | 120 | let range = tmap_2.range_by_token(token_id)?.by_kind(token_to_map.kind())?; |
121 | let token = syntax::algo::find_covering_element(&node.syntax_node(), range).into_token()?; | 121 | let token = node.syntax_node().covering_element(range).into_token()?; |
122 | Some((node.syntax_node(), token)) | 122 | Some((node.syntax_node(), token)) |
123 | } | 123 | } |
124 | 124 | ||
diff --git a/crates/hir_expand/src/lib.rs b/crates/hir_expand/src/lib.rs index 3fa1b1d77..e388ddacc 100644 --- a/crates/hir_expand/src/lib.rs +++ b/crates/hir_expand/src/lib.rs | |||
@@ -22,7 +22,7 @@ use std::sync::Arc; | |||
22 | 22 | ||
23 | use base_db::{impl_intern_key, salsa, CrateId, FileId, FileRange}; | 23 | use base_db::{impl_intern_key, salsa, CrateId, FileId, FileRange}; |
24 | use syntax::{ | 24 | use syntax::{ |
25 | algo::{self, skip_trivia_token}, | 25 | algo::skip_trivia_token, |
26 | ast::{self, AstNode}, | 26 | ast::{self, AstNode}, |
27 | Direction, SyntaxNode, SyntaxToken, TextRange, TextSize, | 27 | Direction, SyntaxNode, SyntaxToken, TextRange, TextSize, |
28 | }; | 28 | }; |
@@ -335,7 +335,7 @@ impl ExpansionInfo { | |||
335 | 335 | ||
336 | let range = self.exp_map.range_by_token(token_id)?.by_kind(token.value.kind())?; | 336 | let range = self.exp_map.range_by_token(token_id)?.by_kind(token.value.kind())?; |
337 | 337 | ||
338 | let token = algo::find_covering_element(&self.expanded.value, range).into_token()?; | 338 | let token = self.expanded.value.covering_element(range).into_token()?; |
339 | 339 | ||
340 | Some(self.expanded.with_value(token)) | 340 | Some(self.expanded.with_value(token)) |
341 | } | 341 | } |
@@ -360,8 +360,8 @@ impl ExpansionInfo { | |||
360 | }; | 360 | }; |
361 | 361 | ||
362 | let range = token_map.range_by_token(token_id)?.by_kind(token.value.kind())?; | 362 | let range = token_map.range_by_token(token_id)?.by_kind(token.value.kind())?; |
363 | let token = algo::find_covering_element(&tt.value, range + tt.value.text_range().start()) | 363 | let token = |
364 | .into_token()?; | 364 | tt.value.covering_element(range + tt.value.text_range().start()).into_token()?; |
365 | Some((tt.with_value(token), origin)) | 365 | Some((tt.with_value(token), origin)) |
366 | } | 366 | } |
367 | } | 367 | } |