11//! `AstTransformer`s are functions that replace nodes in an AST and can be easily combined.
22use rustc_hash:: FxHashMap ;
33
4- use hir:: { db:: HirDatabase , InFile , PathResolution } ;
4+ use hir:: { InFile , PathResolution } ;
5+ use ra_ide_db:: RootDatabase ;
56use ra_syntax:: ast:: { self , AstNode } ;
67
78pub trait AstTransform < ' a > {
@@ -33,18 +34,18 @@ impl<'a> AstTransform<'a> for NullTransformer {
3334 }
3435}
3536
36- pub struct SubstituteTypeParams < ' a , DB : HirDatabase > {
37- db : & ' a DB ,
37+ pub struct SubstituteTypeParams < ' a > {
38+ db : & ' a RootDatabase ,
3839 substs : FxHashMap < hir:: TypeParam , ast:: TypeRef > ,
3940 previous : Box < dyn AstTransform < ' a > + ' a > ,
4041}
4142
42- impl < ' a , DB : HirDatabase > SubstituteTypeParams < ' a , DB > {
43+ impl < ' a > SubstituteTypeParams < ' a > {
4344 pub fn for_trait_impl (
44- db : & ' a DB ,
45+ db : & ' a RootDatabase ,
4546 trait_ : hir:: Trait ,
4647 impl_block : ast:: ImplBlock ,
47- ) -> SubstituteTypeParams < ' a , DB > {
48+ ) -> SubstituteTypeParams < ' a > {
4849 let substs = get_syntactic_substs ( impl_block) . unwrap_or_default ( ) ;
4950 let generic_def: hir:: GenericDef = trait_. into ( ) ;
5051 let substs_by_param: FxHashMap < _ , _ > = generic_def
@@ -95,7 +96,7 @@ impl<'a, DB: HirDatabase> SubstituteTypeParams<'a, DB> {
9596 }
9697}
9798
98- impl < ' a , DB : HirDatabase > AstTransform < ' a > for SubstituteTypeParams < ' a , DB > {
99+ impl < ' a > AstTransform < ' a > for SubstituteTypeParams < ' a > {
99100 fn get_substitution (
100101 & self ,
101102 node : InFile < & ra_syntax:: SyntaxNode > ,
@@ -107,14 +108,14 @@ impl<'a, DB: HirDatabase> AstTransform<'a> for SubstituteTypeParams<'a, DB> {
107108 }
108109}
109110
110- pub struct QualifyPaths < ' a , DB : HirDatabase > {
111- db : & ' a DB ,
111+ pub struct QualifyPaths < ' a > {
112+ db : & ' a RootDatabase ,
112113 from : Option < hir:: Module > ,
113114 previous : Box < dyn AstTransform < ' a > + ' a > ,
114115}
115116
116- impl < ' a , DB : HirDatabase > QualifyPaths < ' a , DB > {
117- pub fn new ( db : & ' a DB , from : Option < hir:: Module > ) -> Self {
117+ impl < ' a > QualifyPaths < ' a > {
118+ pub fn new ( db : & ' a RootDatabase , from : Option < hir:: Module > ) -> Self {
118119 Self { db, from, previous : Box :: new ( NullTransformer ) }
119120 }
120121
@@ -168,7 +169,7 @@ pub fn apply<'a, N: AstNode>(transformer: &dyn AstTransform<'a>, node: InFile<N>
168169 N :: cast ( result) . unwrap ( )
169170}
170171
171- impl < ' a , DB : HirDatabase > AstTransform < ' a > for QualifyPaths < ' a , DB > {
172+ impl < ' a > AstTransform < ' a > for QualifyPaths < ' a > {
172173 fn get_substitution (
173174 & self ,
174175 node : InFile < & ra_syntax:: SyntaxNode > ,
0 commit comments