diff options
author | Aleksey Kladov <[email protected]> | 2019-09-26 20:08:44 +0100 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2019-09-26 20:22:08 +0100 |
commit | d847d53e36571c8f7925b72cedf66bb203976148 (patch) | |
tree | 3fd5903b67b498a39660b2dafdc929f33d41900e /crates/ra_assists/src/assists/add_missing_impl_members.rs | |
parent | 1a4b42400544a652a053a34263967689d47f554b (diff) |
Start simplifying editing API
Diffstat (limited to 'crates/ra_assists/src/assists/add_missing_impl_members.rs')
-rw-r--r-- | crates/ra_assists/src/assists/add_missing_impl_members.rs | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/crates/ra_assists/src/assists/add_missing_impl_members.rs b/crates/ra_assists/src/assists/add_missing_impl_members.rs index 23da1e65f..682455bce 100644 --- a/crates/ra_assists/src/assists/add_missing_impl_members.rs +++ b/crates/ra_assists/src/assists/add_missing_impl_members.rs | |||
@@ -100,12 +100,11 @@ fn strip_docstring(item: ast::ImplItem) -> ast::ImplItem { | |||
100 | } | 100 | } |
101 | 101 | ||
102 | fn add_body(fn_def: ast::FnDef) -> ast::FnDef { | 102 | fn add_body(fn_def: ast::FnDef) -> ast::FnDef { |
103 | let mut ast_editor = AstEditor::new(fn_def.clone()); | ||
104 | if fn_def.body().is_none() { | 103 | if fn_def.body().is_none() { |
105 | let body = make::block_from_expr(make::expr_unimplemented()); | 104 | fn_def.with_body(make::block_from_expr(make::expr_unimplemented())) |
106 | ast_editor.set_body(&body); | 105 | } else { |
106 | fn_def | ||
107 | } | 107 | } |
108 | ast_editor.ast().to_owned() | ||
109 | } | 108 | } |
110 | 109 | ||
111 | /// Given an `ast::ImplBlock`, resolves the target trait (the one being | 110 | /// Given an `ast::ImplBlock`, resolves the target trait (the one being |
@@ -332,5 +331,4 @@ impl Foo for S { | |||
332 | }", | 331 | }", |
333 | ) | 332 | ) |
334 | } | 333 | } |
335 | |||
336 | } | 334 | } |