From a1f2c7adcd926fdbe6b5ce10dcdc059acc147b3e Mon Sep 17 00:00:00 2001 From: Yoshua Wuyts Date: Sun, 8 Aug 2021 14:11:47 +0200 Subject: [PATCH] rename variables According to https://github.com/rust-analyzer/rust-analyzer/blob/master/docs/dev/style.md#variable-naming --- .../handlers/replace_derive_with_manual_impl.rs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/crates/ide_assists/src/handlers/replace_derive_with_manual_impl.rs b/crates/ide_assists/src/handlers/replace_derive_with_manual_impl.rs index 3ad1c46878c9..e0319adccc61 100644 --- a/crates/ide_assists/src/handlers/replace_derive_with_manual_impl.rs +++ b/crates/ide_assists/src/handlers/replace_derive_with_manual_impl.rs @@ -170,18 +170,18 @@ fn impl_def_from_trait( let (impl_def, first_assoc_item) = add_trait_assoc_items_to_impl(sema, trait_items, trait_, impl_def, target_scope); - if let ast::AssocItem::Fn(fn_) = &first_assoc_item { + if let ast::AssocItem::Fn(func) = &first_assoc_item { if trait_path.segment().unwrap().name_ref().unwrap().text() == "Debug" { - gen_debug_impl(adt, fn_, annotated_name); + gen_debug_impl(adt, func, annotated_name); } } Some((impl_def, first_assoc_item)) } -fn gen_debug_impl(adt: &ast::Adt, fn_: &ast::Fn, annotated_name: &ast::Name) { +fn gen_debug_impl(adt: &ast::Adt, func: &ast::Fn, annotated_name: &ast::Name) { match adt { ast::Adt::Union(_) => {} // `Debug` cannot be derived for unions, so no default impl can be provided. - ast::Adt::Enum(_) => {} // TODO + ast::Adt::Enum(enum_) => {} // TODO ast::Adt::Struct(strukt) => match strukt.field_list() { Some(ast::FieldList::RecordFieldList(field_list)) => { let name = format!("\"{}\"", annotated_name); @@ -200,7 +200,7 @@ fn gen_debug_impl(adt: &ast::Adt, fn_: &ast::Fn, annotated_name: &ast::Name) { } let expr = make::expr_method_call(expr, "finish", make::arg_list(None)); let body = make::block_expr(None, Some(expr)).indent(ast::edit::IndentLevel(1)); - ted::replace(fn_.body().unwrap().syntax(), body.clone_for_update().syntax()); + ted::replace(func.body().unwrap().syntax(), body.clone_for_update().syntax()); } Some(ast::FieldList::TupleFieldList(field_list)) => { let name = format!("\"{}\"", annotated_name); @@ -216,7 +216,7 @@ fn gen_debug_impl(adt: &ast::Adt, fn_: &ast::Fn, annotated_name: &ast::Name) { } let expr = make::expr_method_call(expr, "finish", make::arg_list(None)); let body = make::block_expr(None, Some(expr)).indent(ast::edit::IndentLevel(1)); - ted::replace(fn_.body().unwrap().syntax(), body.clone_for_update().syntax()); + ted::replace(func.body().unwrap().syntax(), body.clone_for_update().syntax()); } None => { let name = format!("\"{}\"", annotated_name); @@ -225,7 +225,7 @@ fn gen_debug_impl(adt: &ast::Adt, fn_: &ast::Fn, annotated_name: &ast::Name) { let expr = make::expr_method_call(target, "debug_struct", args); let expr = make::expr_method_call(expr, "finish", make::arg_list(None)); let body = make::block_expr(None, Some(expr)).indent(ast::edit::IndentLevel(1)); - ted::replace(fn_.body().unwrap().syntax(), body.clone_for_update().syntax()); + ted::replace(func.body().unwrap().syntax(), body.clone_for_update().syntax()); } }, }