@@ -10,7 +10,7 @@ use ra_syntax::{
1010
1111use crate :: {
1212 ast_transform:: { self , AstTransform , QualifyPaths , SubstituteTypeParams } ,
13- utils:: { get_missing_impl_items , resolve_target_trait} ,
13+ utils:: { get_missing_assoc_items , resolve_target_trait} ,
1414 Assist , AssistCtx , AssistId ,
1515} ;
1616
@@ -112,25 +112,25 @@ fn add_missing_impl_members_inner(
112112
113113 let trait_ = resolve_target_trait ( & ctx. sema , & impl_node) ?;
114114
115- let def_name = |item : & ast:: ImplItem | -> Option < SmolStr > {
115+ let def_name = |item : & ast:: AssocItem | -> Option < SmolStr > {
116116 match item {
117- ast:: ImplItem :: FnDef ( def) => def. name ( ) ,
118- ast:: ImplItem :: TypeAliasDef ( def) => def. name ( ) ,
119- ast:: ImplItem :: ConstDef ( def) => def. name ( ) ,
117+ ast:: AssocItem :: FnDef ( def) => def. name ( ) ,
118+ ast:: AssocItem :: TypeAliasDef ( def) => def. name ( ) ,
119+ ast:: AssocItem :: ConstDef ( def) => def. name ( ) ,
120120 }
121121 . map ( |it| it. text ( ) . clone ( ) )
122122 } ;
123123
124- let missing_items = get_missing_impl_items ( & ctx. sema , & impl_node)
124+ let missing_items = get_missing_assoc_items ( & ctx. sema , & impl_node)
125125 . iter ( )
126126 . map ( |i| match i {
127- hir:: AssocItem :: Function ( i) => ast:: ImplItem :: FnDef ( i. source ( ctx. db ) . value ) ,
128- hir:: AssocItem :: TypeAlias ( i) => ast:: ImplItem :: TypeAliasDef ( i. source ( ctx. db ) . value ) ,
129- hir:: AssocItem :: Const ( i) => ast:: ImplItem :: ConstDef ( i. source ( ctx. db ) . value ) ,
127+ hir:: AssocItem :: Function ( i) => ast:: AssocItem :: FnDef ( i. source ( ctx. db ) . value ) ,
128+ hir:: AssocItem :: TypeAlias ( i) => ast:: AssocItem :: TypeAliasDef ( i. source ( ctx. db ) . value ) ,
129+ hir:: AssocItem :: Const ( i) => ast:: AssocItem :: ConstDef ( i. source ( ctx. db ) . value ) ,
130130 } )
131131 . filter ( |t| def_name ( & t) . is_some ( ) )
132132 . filter ( |t| match t {
133- ast:: ImplItem :: FnDef ( def) => match mode {
133+ ast:: AssocItem :: FnDef ( def) => match mode {
134134 AddMissingImplMembersMode :: DefaultMethodsOnly => def. body ( ) . is_some ( ) ,
135135 AddMissingImplMembersMode :: NoDefaultMethods => def. body ( ) . is_none ( ) ,
136136 } ,
@@ -145,7 +145,7 @@ fn add_missing_impl_members_inner(
145145 let sema = ctx. sema ;
146146
147147 ctx. add_assist ( AssistId ( assist_id) , label, |edit| {
148- let n_existing_items = impl_item_list. impl_items ( ) . count ( ) ;
148+ let n_existing_items = impl_item_list. assoc_items ( ) . count ( ) ;
149149 let source_scope = sema. scope_for_def ( trait_) ;
150150 let target_scope = sema. scope ( impl_item_list. syntax ( ) ) ;
151151 let ast_transform = QualifyPaths :: new ( & target_scope, & source_scope)
@@ -154,13 +154,13 @@ fn add_missing_impl_members_inner(
154154 . into_iter ( )
155155 . map ( |it| ast_transform:: apply ( & * ast_transform, it) )
156156 . map ( |it| match it {
157- ast:: ImplItem :: FnDef ( def) => ast:: ImplItem :: FnDef ( add_body ( def) ) ,
157+ ast:: AssocItem :: FnDef ( def) => ast:: AssocItem :: FnDef ( add_body ( def) ) ,
158158 _ => it,
159159 } )
160160 . map ( |it| edit:: remove_attrs_and_docs ( & it) ) ;
161161 let new_impl_item_list = impl_item_list. append_items ( items) ;
162162 let cursor_position = {
163- let first_new_item = new_impl_item_list. impl_items ( ) . nth ( n_existing_items) . unwrap ( ) ;
163+ let first_new_item = new_impl_item_list. assoc_items ( ) . nth ( n_existing_items) . unwrap ( ) ;
164164 first_new_item. syntax ( ) . text_range ( ) . start ( )
165165 } ;
166166
0 commit comments