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 | |
parent | 1a4b42400544a652a053a34263967689d47f554b (diff) |
Start simplifying editing API
Diffstat (limited to 'crates/ra_assists/src/assists')
-rw-r--r-- | crates/ra_assists/src/assists/add_missing_impl_members.rs | 8 | ||||
-rw-r--r-- | crates/ra_assists/src/assists/auto_import.rs | 1 |
2 files changed, 3 insertions, 6 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 | } |
diff --git a/crates/ra_assists/src/assists/auto_import.rs b/crates/ra_assists/src/assists/auto_import.rs index 5aae98546..a91c170b9 100644 --- a/crates/ra_assists/src/assists/auto_import.rs +++ b/crates/ra_assists/src/assists/auto_import.rs | |||
@@ -448,7 +448,6 @@ fn make_assist_add_in_tree_list( | |||
448 | fmt_segments_raw(target, &mut buf); | 448 | fmt_segments_raw(target, &mut buf); |
449 | edit.insert(offset, buf); | 449 | edit.insert(offset, buf); |
450 | } else { | 450 | } else { |
451 | |||
452 | } | 451 | } |
453 | } | 452 | } |
454 | 453 | ||