From 5953cbd7aefa90da67829fe8e92d066b460ee447 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lauren=C8=9Biu=20Nicola?= Date: Wed, 1 Jul 2020 09:34:45 +0300 Subject: Make SemanticsScope non-generic --- crates/ra_assists/src/ast_transform.rs | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) (limited to 'crates/ra_assists/src') diff --git a/crates/ra_assists/src/ast_transform.rs b/crates/ra_assists/src/ast_transform.rs index 00fa95b6c..01adb834c 100644 --- a/crates/ra_assists/src/ast_transform.rs +++ b/crates/ra_assists/src/ast_transform.rs @@ -2,7 +2,6 @@ use rustc_hash::FxHashMap; use hir::{HirDisplay, PathResolution, SemanticsScope}; -use ra_ide_db::RootDatabase; use ra_syntax::{ algo::SyntaxRewriter, ast::{self, AstNode}, @@ -32,14 +31,14 @@ impl<'a> AstTransform<'a> for NullTransformer { } pub struct SubstituteTypeParams<'a> { - source_scope: &'a SemanticsScope<'a, RootDatabase>, + source_scope: &'a SemanticsScope<'a>, substs: FxHashMap, previous: Box + 'a>, } impl<'a> SubstituteTypeParams<'a> { pub fn for_trait_impl( - source_scope: &'a SemanticsScope<'a, RootDatabase>, + source_scope: &'a SemanticsScope<'a>, // FIXME: there's implicit invariant that `trait_` and `source_scope` match... trait_: hir::Trait, impl_def: ast::ImplDef, @@ -126,16 +125,13 @@ impl<'a> AstTransform<'a> for SubstituteTypeParams<'a> { } pub struct QualifyPaths<'a> { - target_scope: &'a SemanticsScope<'a, RootDatabase>, - source_scope: &'a SemanticsScope<'a, RootDatabase>, + target_scope: &'a SemanticsScope<'a>, + source_scope: &'a SemanticsScope<'a>, previous: Box + 'a>, } impl<'a> QualifyPaths<'a> { - pub fn new( - target_scope: &'a SemanticsScope<'a, RootDatabase>, - source_scope: &'a SemanticsScope<'a, RootDatabase>, - ) -> Self { + pub fn new(target_scope: &'a SemanticsScope<'a>, source_scope: &'a SemanticsScope<'a>) -> Self { Self { target_scope, source_scope, previous: Box::new(NullTransformer) } } @@ -156,7 +152,7 @@ impl<'a> QualifyPaths<'a> { let resolution = self.source_scope.resolve_hir_path(&hir_path?)?; match resolution { PathResolution::Def(def) => { - let found_path = from.find_use_path(self.source_scope.db, def)?; + let found_path = from.find_use_path(self.source_scope.db.upcast(), def)?; let mut path = path_to_ast(found_path); let type_args = p -- cgit v1.2.3