@@ -170,18 +170,18 @@ fn impl_def_from_trait(
170
170
let ( impl_def, first_assoc_item) =
171
171
add_trait_assoc_items_to_impl ( sema, trait_items, trait_, impl_def, target_scope) ;
172
172
173
- if let ast:: AssocItem :: Fn ( fn_ ) = & first_assoc_item {
173
+ if let ast:: AssocItem :: Fn ( func ) = & first_assoc_item {
174
174
if trait_path. segment ( ) . unwrap ( ) . name_ref ( ) . unwrap ( ) . text ( ) == "Debug" {
175
- gen_debug_impl ( adt, fn_ , annotated_name) ;
175
+ gen_debug_impl ( adt, func , annotated_name) ;
176
176
}
177
177
}
178
178
Some ( ( impl_def, first_assoc_item) )
179
179
}
180
180
181
- fn gen_debug_impl ( adt : & ast:: Adt , fn_ : & ast:: Fn , annotated_name : & ast:: Name ) {
181
+ fn gen_debug_impl ( adt : & ast:: Adt , func : & ast:: Fn , annotated_name : & ast:: Name ) {
182
182
match adt {
183
183
ast:: Adt :: Union ( _) => { } // `Debug` cannot be derived for unions, so no default impl can be provided.
184
- ast:: Adt :: Enum ( _ ) => { } // TODO
184
+ ast:: Adt :: Enum ( enum_ ) => { } // TODO
185
185
ast:: Adt :: Struct ( strukt) => match strukt. field_list ( ) {
186
186
Some ( ast:: FieldList :: RecordFieldList ( field_list) ) => {
187
187
let name = format ! ( "\" {}\" " , annotated_name) ;
@@ -200,7 +200,7 @@ fn gen_debug_impl(adt: &ast::Adt, fn_: &ast::Fn, annotated_name: &ast::Name) {
200
200
}
201
201
let expr = make:: expr_method_call ( expr, "finish" , make:: arg_list ( None ) ) ;
202
202
let body = make:: block_expr ( None , Some ( expr) ) . indent ( ast:: edit:: IndentLevel ( 1 ) ) ;
203
- ted:: replace ( fn_ . body ( ) . unwrap ( ) . syntax ( ) , body. clone_for_update ( ) . syntax ( ) ) ;
203
+ ted:: replace ( func . body ( ) . unwrap ( ) . syntax ( ) , body. clone_for_update ( ) . syntax ( ) ) ;
204
204
}
205
205
Some ( ast:: FieldList :: TupleFieldList ( field_list) ) => {
206
206
let name = format ! ( "\" {}\" " , annotated_name) ;
@@ -216,7 +216,7 @@ fn gen_debug_impl(adt: &ast::Adt, fn_: &ast::Fn, annotated_name: &ast::Name) {
216
216
}
217
217
let expr = make:: expr_method_call ( expr, "finish" , make:: arg_list ( None ) ) ;
218
218
let body = make:: block_expr ( None , Some ( expr) ) . indent ( ast:: edit:: IndentLevel ( 1 ) ) ;
219
- ted:: replace ( fn_ . body ( ) . unwrap ( ) . syntax ( ) , body. clone_for_update ( ) . syntax ( ) ) ;
219
+ ted:: replace ( func . body ( ) . unwrap ( ) . syntax ( ) , body. clone_for_update ( ) . syntax ( ) ) ;
220
220
}
221
221
None => {
222
222
let name = format ! ( "\" {}\" " , annotated_name) ;
@@ -225,7 +225,7 @@ fn gen_debug_impl(adt: &ast::Adt, fn_: &ast::Fn, annotated_name: &ast::Name) {
225
225
let expr = make:: expr_method_call ( target, "debug_struct" , args) ;
226
226
let expr = make:: expr_method_call ( expr, "finish" , make:: arg_list ( None ) ) ;
227
227
let body = make:: block_expr ( None , Some ( expr) ) . indent ( ast:: edit:: IndentLevel ( 1 ) ) ;
228
- ted:: replace ( fn_ . body ( ) . unwrap ( ) . syntax ( ) , body. clone_for_update ( ) . syntax ( ) ) ;
228
+ ted:: replace ( func . body ( ) . unwrap ( ) . syntax ( ) , body. clone_for_update ( ) . syntax ( ) ) ;
229
229
}
230
230
} ,
231
231
}
0 commit comments