From 82d6cfd495c7e0f230ce1ac61e7a4297fa22f02f Mon Sep 17 00:00:00 2001 From: kjeremy Date: Wed, 30 Sep 2020 15:22:49 -0400 Subject: Minor clippy performance suggestions --- crates/assists/src/handlers/add_missing_impl_members.rs | 2 +- crates/assists/src/handlers/extract_struct_from_enum_variant.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'crates/assists/src/handlers') diff --git a/crates/assists/src/handlers/add_missing_impl_members.rs b/crates/assists/src/handlers/add_missing_impl_members.rs index 1ac5fefd6..51b5a2eb0 100644 --- a/crates/assists/src/handlers/add_missing_impl_members.rs +++ b/crates/assists/src/handlers/add_missing_impl_members.rs @@ -146,7 +146,7 @@ fn add_missing_impl_members_inner( let target = impl_def.syntax().text_range(); acc.add(AssistId(assist_id, AssistKind::QuickFix), label, target, |builder| { - let impl_item_list = impl_def.assoc_item_list().unwrap_or(make::assoc_item_list()); + let impl_item_list = impl_def.assoc_item_list().unwrap_or_else(make::assoc_item_list); let n_existing_items = impl_item_list.assoc_items().count(); let source_scope = ctx.sema.scope_for_def(trait_); diff --git a/crates/assists/src/handlers/extract_struct_from_enum_variant.rs b/crates/assists/src/handlers/extract_struct_from_enum_variant.rs index d1eadaa99..f5f03ef36 100644 --- a/crates/assists/src/handlers/extract_struct_from_enum_variant.rs +++ b/crates/assists/src/handlers/extract_struct_from_enum_variant.rs @@ -91,7 +91,7 @@ fn existing_struct_def(db: &RootDatabase, variant_name: &str, variant: &EnumVari .module(db) .scope(db, None) .into_iter() - .any(|(name, _)| name.to_string() == variant_name.to_string()) + .any(|(name, _)| name.to_string() == variant_name) } #[allow(dead_code)] -- cgit v1.2.3