Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit f24fbc2

Browse files
committed
rustfmt
1 parent d5e6aa3 commit f24fbc2

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

crates/ide-assists/src/handlers/extract_function.rs

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -127,10 +127,8 @@ pub(crate) fn extract_function(acc: &mut Assists, ctx: &AssistContext<'_>) -> Op
127127

128128
builder.replace(target_range, make_call(ctx, &fun, old_indent));
129129

130-
let has_impl_wrapper = insert_after
131-
.ancestors()
132-
.find(|a| a.kind() == SyntaxKind::IMPL && a != &insert_after)
133-
.is_some();
130+
let has_impl_wrapper =
131+
insert_after.ancestors().any(|a| a.kind() == SyntaxKind::IMPL && a != insert_after);
134132

135133
let fn_def = match fun.self_param_adt(ctx) {
136134
Some(adt) if anchor == Anchor::Method && !has_impl_wrapper => {
@@ -1250,8 +1248,7 @@ fn node_to_insert_after(body: &FunctionBody, anchor: Anchor) -> Option<SyntaxNod
12501248
SyntaxKind::IMPL => {
12511249
if body.extracted_from_trait_impl() && matches!(anchor, Anchor::Method) {
12521250
let impl_node = find_non_trait_impl(&next_ancestor);
1253-
let target_node = impl_node.as_ref().and_then(last_impl_member);
1254-
if target_node.is_some() {
1251+
if let target_node @ Some(_) = impl_node.as_ref().and_then(last_impl_member) {
12551252
return target_node;
12561253
}
12571254
}
@@ -1281,7 +1278,8 @@ fn find_non_trait_impl(trait_impl: &SyntaxNode) -> Option<ast::Impl> {
12811278
let impl_type = Some(impl_type_name(&as_impl)?);
12821279

12831280
let sibblings = trait_impl.parent()?.children();
1284-
sibblings.filter_map(ast::Impl::cast)
1281+
sibblings
1282+
.filter_map(ast::Impl::cast)
12851283
.find(|s| impl_type_name(s) == impl_type && !is_trait_impl(s))
12861284
}
12871285

0 commit comments

Comments
 (0)