From 6dbba4d75d56728a95f84ee978eae3ac84016c73 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Fri, 15 Jan 2021 20:15:33 +0300 Subject: Remove useless wrapper --- crates/hir_expand/src/db.rs | 2 +- crates/hir_expand/src/lib.rs | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'crates/hir_expand') 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( parse_macro_with_arg(db, macro_file, Some(std::sync::Arc::new((tt, tmap_1)))).value?; let token_id = macro_def.0.map_id_down(token_id); let range = tmap_2.range_by_token(token_id)?.by_kind(token_to_map.kind())?; - let token = syntax::algo::find_covering_element(&node.syntax_node(), range).into_token()?; + let token = node.syntax_node().covering_element(range).into_token()?; Some((node.syntax_node(), token)) } 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; use base_db::{impl_intern_key, salsa, CrateId, FileId, FileRange}; use syntax::{ - algo::{self, skip_trivia_token}, + algo::skip_trivia_token, ast::{self, AstNode}, Direction, SyntaxNode, SyntaxToken, TextRange, TextSize, }; @@ -335,7 +335,7 @@ impl ExpansionInfo { let range = self.exp_map.range_by_token(token_id)?.by_kind(token.value.kind())?; - let token = algo::find_covering_element(&self.expanded.value, range).into_token()?; + let token = self.expanded.value.covering_element(range).into_token()?; Some(self.expanded.with_value(token)) } @@ -360,8 +360,8 @@ impl ExpansionInfo { }; let range = token_map.range_by_token(token_id)?.by_kind(token.value.kind())?; - let token = algo::find_covering_element(&tt.value, range + tt.value.text_range().start()) - .into_token()?; + let token = + tt.value.covering_element(range + tt.value.text_range().start()).into_token()?; Some((tt.with_value(token), origin)) } } -- cgit v1.2.3