diff options
author | kjeremy <[email protected]> | 2020-09-30 20:22:49 +0100 |
---|---|---|
committer | kjeremy <[email protected]> | 2020-09-30 20:22:49 +0100 |
commit | 82d6cfd495c7e0f230ce1ac61e7a4297fa22f02f (patch) | |
tree | 3a6fceb66786f1b6dd0bf711182b21dd6bd2280a /crates/assists | |
parent | 7c9ae771bca39d511a0ea7395da2b4b91b44ee12 (diff) |
Minor clippy performance suggestions
Diffstat (limited to 'crates/assists')
-rw-r--r-- | crates/assists/src/handlers/add_missing_impl_members.rs | 2 | ||||
-rw-r--r-- | crates/assists/src/handlers/extract_struct_from_enum_variant.rs | 2 |
2 files changed, 2 insertions, 2 deletions
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( | |||
146 | 146 | ||
147 | let target = impl_def.syntax().text_range(); | 147 | let target = impl_def.syntax().text_range(); |
148 | acc.add(AssistId(assist_id, AssistKind::QuickFix), label, target, |builder| { | 148 | acc.add(AssistId(assist_id, AssistKind::QuickFix), label, target, |builder| { |
149 | let impl_item_list = impl_def.assoc_item_list().unwrap_or(make::assoc_item_list()); | 149 | let impl_item_list = impl_def.assoc_item_list().unwrap_or_else(make::assoc_item_list); |
150 | 150 | ||
151 | let n_existing_items = impl_item_list.assoc_items().count(); | 151 | let n_existing_items = impl_item_list.assoc_items().count(); |
152 | let source_scope = ctx.sema.scope_for_def(trait_); | 152 | 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 | |||
91 | .module(db) | 91 | .module(db) |
92 | .scope(db, None) | 92 | .scope(db, None) |
93 | .into_iter() | 93 | .into_iter() |
94 | .any(|(name, _)| name.to_string() == variant_name.to_string()) | 94 | .any(|(name, _)| name.to_string() == variant_name) |
95 | } | 95 | } |
96 | 96 | ||
97 | #[allow(dead_code)] | 97 | #[allow(dead_code)] |