Update crates/ide-assists/src/handlers/generate_trait_from_impl.rs

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
This commit is contained in:
Ali Bektas 2023-06-28 12:25:31 +02:00
parent 677151e4e1
commit 20c877a700

View File

@ -73,13 +73,7 @@ pub(crate) fn generate_trait_from_impl(acc: &mut Assists, ctx: &AssistContext<'_
return None;
}
let assoc_items = impl_ast.assoc_item_list();
if assoc_items.is_none() {
// Also do not do anything if no assoc item is there.
return None;
}
let assoc_items = assoc_items.unwrap();
let assoc_items = impl_ast.assoc_item_list()?;
let first_element = assoc_items.assoc_items().next();
if first_element.is_none() {
// No reason for an assist.