diff options
author | Aleksey Kladov <[email protected]> | 2018-08-22 10:58:34 +0100 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2018-08-22 10:58:34 +0100 |
commit | e8dfb92641f64b772204d7670c7286cb9b8b398b (patch) | |
tree | bb305d3003d01756fc8c282f008108d05da7decf /crates/libeditor/src/code_actions.rs | |
parent | 641659d5a8dcca0b8a1c36ff6d1c517a91296116 (diff) |
Simplify
Diffstat (limited to 'crates/libeditor/src/code_actions.rs')
-rw-r--r-- | crates/libeditor/src/code_actions.rs | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/crates/libeditor/src/code_actions.rs b/crates/libeditor/src/code_actions.rs index 80c396337..500d52c2a 100644 --- a/crates/libeditor/src/code_actions.rs +++ b/crates/libeditor/src/code_actions.rs | |||
@@ -11,12 +11,7 @@ use libsyntax2::{ | |||
11 | 11 | ||
12 | pub struct ActionResult { | 12 | pub struct ActionResult { |
13 | pub edit: Edit, | 13 | pub edit: Edit, |
14 | pub cursor_position: CursorPosition, | 14 | pub cursor_position: Option<TextUnit>, |
15 | } | ||
16 | |||
17 | pub enum CursorPosition { | ||
18 | Same, | ||
19 | Offset(TextUnit), | ||
20 | } | 15 | } |
21 | 16 | ||
22 | pub fn flip_comma<'a>(file: &'a ParsedFile, offset: TextUnit) -> Option<impl FnOnce() -> ActionResult + 'a> { | 17 | pub fn flip_comma<'a>(file: &'a ParsedFile, offset: TextUnit) -> Option<impl FnOnce() -> ActionResult + 'a> { |
@@ -31,7 +26,7 @@ pub fn flip_comma<'a>(file: &'a ParsedFile, offset: TextUnit) -> Option<impl FnO | |||
31 | edit.replace(right.range(), left.text()); | 26 | edit.replace(right.range(), left.text()); |
32 | ActionResult { | 27 | ActionResult { |
33 | edit: edit.finish(), | 28 | edit: edit.finish(), |
34 | cursor_position: CursorPosition::Same, | 29 | cursor_position: None, |
35 | } | 30 | } |
36 | }) | 31 | }) |
37 | } | 32 | } |
@@ -58,7 +53,7 @@ pub fn add_derive<'a>(file: &'a ParsedFile, offset: TextUnit) -> Option<impl FnO | |||
58 | }; | 53 | }; |
59 | ActionResult { | 54 | ActionResult { |
60 | edit: edit.finish(), | 55 | edit: edit.finish(), |
61 | cursor_position: CursorPosition::Offset(offset), | 56 | cursor_position: Some(offset), |
62 | } | 57 | } |
63 | }) | 58 | }) |
64 | } | 59 | } |