aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_assists/src/ast_transform.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_assists/src/ast_transform.rs')
-rw-r--r--crates/ra_assists/src/ast_transform.rs13
1 files changed, 5 insertions, 8 deletions
diff --git a/crates/ra_assists/src/ast_transform.rs b/crates/ra_assists/src/ast_transform.rs
index 15ec75c95..02c4a4bae 100644
--- a/crates/ra_assists/src/ast_transform.rs
+++ b/crates/ra_assists/src/ast_transform.rs
@@ -2,6 +2,7 @@
2use rustc_hash::FxHashMap; 2use rustc_hash::FxHashMap;
3 3
4use hir::{HirDisplay, PathResolution, SemanticsScope}; 4use hir::{HirDisplay, PathResolution, SemanticsScope};
5use hir_expand::hygiene::Hygiene;
5use ra_syntax::{ 6use ra_syntax::{
6 algo::SyntaxRewriter, 7 algo::SyntaxRewriter,
7 ast::{self, AstNode}, 8 ast::{self, AstNode},
@@ -51,7 +52,7 @@ impl<'a> SubstituteTypeParams<'a> {
51 // this is a trait impl, so we need to skip the first type parameter -- this is a bit hacky 52 // this is a trait impl, so we need to skip the first type parameter -- this is a bit hacky
52 .skip(1) 53 .skip(1)
53 // The actual list of trait type parameters may be longer than the one 54 // The actual list of trait type parameters may be longer than the one
54 // used in the `impl` block due to trailing default type parametrs. 55 // used in the `impl` block due to trailing default type parameters.
55 // For that case we extend the `substs` with an empty iterator so we 56 // For that case we extend the `substs` with an empty iterator so we
56 // can still hit those trailing values and check if they actually have 57 // can still hit those trailing values and check if they actually have
57 // a default type. If they do, go for that type from `hir` to `ast` so 58 // a default type. If they do, go for that type from `hir` to `ast` so
@@ -110,9 +111,7 @@ impl<'a> SubstituteTypeParams<'a> {
110 ast::Type::PathType(path_type) => path_type.path()?, 111 ast::Type::PathType(path_type) => path_type.path()?,
111 _ => return None, 112 _ => return None,
112 }; 113 };
113 // FIXME: use `hir::Path::from_src` instead. 114 let path = hir::Path::from_src(path, &Hygiene::new_unhygienic())?;
114 #[allow(deprecated)]
115 let path = hir::Path::from_ast(path)?;
116 let resolution = self.source_scope.resolve_hir_path(&path)?; 115 let resolution = self.source_scope.resolve_hir_path(&path)?;
117 match resolution { 116 match resolution {
118 hir::PathResolution::TypeParam(tp) => Some(self.substs.get(&tp)?.syntax().clone()), 117 hir::PathResolution::TypeParam(tp) => Some(self.substs.get(&tp)?.syntax().clone()),
@@ -152,10 +151,8 @@ impl<'a> QualifyPaths<'a> {
152 // don't try to qualify `Fn(Foo) -> Bar` paths, they are in prelude anyway 151 // don't try to qualify `Fn(Foo) -> Bar` paths, they are in prelude anyway
153 return None; 152 return None;
154 } 153 }
155 // FIXME: use `hir::Path::from_src` instead. 154 let hir_path = hir::Path::from_src(p.clone(), &Hygiene::new_unhygienic())?;
156 #[allow(deprecated)] 155 let resolution = self.source_scope.resolve_hir_path(&hir_path)?;
157 let hir_path = hir::Path::from_ast(p.clone());
158 let resolution = self.source_scope.resolve_hir_path(&hir_path?)?;
159 match resolution { 156 match resolution {
160 PathResolution::Def(def) => { 157 PathResolution::Def(def) => {
161 let found_path = from.find_use_path(self.source_scope.db.upcast(), def)?; 158 let found_path = from.find_use_path(self.source_scope.db.upcast(), def)?;