Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/ide-assists/src/handlers/generate_trait_from_impl.rs')
-rw-r--r--crates/ide-assists/src/handlers/generate_trait_from_impl.rs21
1 files changed, 9 insertions, 12 deletions
diff --git a/crates/ide-assists/src/handlers/generate_trait_from_impl.rs b/crates/ide-assists/src/handlers/generate_trait_from_impl.rs
index 8f61b43cd0..a8817436ba 100644
--- a/crates/ide-assists/src/handlers/generate_trait_from_impl.rs
+++ b/crates/ide-assists/src/handlers/generate_trait_from_impl.rs
@@ -181,21 +181,18 @@ fn remove_items_visibility(item: &ast::AssocItem) {
}
fn strip_body(item: &ast::AssocItem) {
- match item {
- ast::AssocItem::Fn(f) => {
- if let Some(body) = f.body() {
- // In constrast to function bodies, we want to see no ws before a semicolon.
- // So let's remove them if we see any.
- if let Some(prev) = body.syntax().prev_sibling_or_token() {
- if prev.kind() == SyntaxKind::WHITESPACE {
- ted::remove(prev);
- }
+ if let ast::AssocItem::Fn(f) = item {
+ if let Some(body) = f.body() {
+ // In constrast to function bodies, we want to see no ws before a semicolon.
+ // So let's remove them if we see any.
+ if let Some(prev) = body.syntax().prev_sibling_or_token() {
+ if prev.kind() == SyntaxKind::WHITESPACE {
+ ted::remove(prev);
}
-
- ted::replace(body.syntax(), make::tokens::semicolon());
}
+
+ ted::replace(body.syntax(), make::tokens::semicolon());
}
- _ => (),
};
}