diff options
author | Aleksey Kladov <[email protected]> | 2020-06-08 20:44:42 +0100 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2020-06-08 20:48:23 +0100 |
commit | 2a42904680041664621034c22c3f600a47107a5a (patch) | |
tree | 2e97754c3295a7fba7b36e03695fd11b85b5d149 /crates/ra_ide_db | |
parent | 3a7c218fd40c77246c94d28b36b1c567492e5bcb (diff) |
Simplify
Diffstat (limited to 'crates/ra_ide_db')
-rw-r--r-- | crates/ra_ide_db/src/source_change.rs | 23 |
1 files changed, 7 insertions, 16 deletions
diff --git a/crates/ra_ide_db/src/source_change.rs b/crates/ra_ide_db/src/source_change.rs index e713f4b7e..f40ae8304 100644 --- a/crates/ra_ide_db/src/source_change.rs +++ b/crates/ra_ide_db/src/source_change.rs | |||
@@ -22,17 +22,6 @@ impl SourceChange { | |||
22 | ) -> Self { | 22 | ) -> Self { |
23 | SourceChange { source_file_edits, file_system_edits, is_snippet: false } | 23 | SourceChange { source_file_edits, file_system_edits, is_snippet: false } |
24 | } | 24 | } |
25 | |||
26 | /// Creates a new SourceChange with the given label, | ||
27 | /// containing only the given `SourceFileEdits`. | ||
28 | pub fn source_file_edits(edits: Vec<SourceFileEdit>) -> Self { | ||
29 | SourceChange { source_file_edits: edits, file_system_edits: vec![], is_snippet: false } | ||
30 | } | ||
31 | /// Creates a new SourceChange with the given label | ||
32 | /// from the given `FileId` and `TextEdit` | ||
33 | pub fn source_file_edit_from(file_id: FileId, edit: TextEdit) -> Self { | ||
34 | SourceFileEdit { file_id, edit }.into() | ||
35 | } | ||
36 | } | 25 | } |
37 | 26 | ||
38 | #[derive(Debug, Clone)] | 27 | #[derive(Debug, Clone)] |
@@ -43,11 +32,13 @@ pub struct SourceFileEdit { | |||
43 | 32 | ||
44 | impl From<SourceFileEdit> for SourceChange { | 33 | impl From<SourceFileEdit> for SourceChange { |
45 | fn from(edit: SourceFileEdit) -> SourceChange { | 34 | fn from(edit: SourceFileEdit) -> SourceChange { |
46 | SourceChange { | 35 | vec![edit].into() |
47 | source_file_edits: vec![edit], | 36 | } |
48 | file_system_edits: Vec::new(), | 37 | } |
49 | is_snippet: false, | 38 | |
50 | } | 39 | impl From<Vec<SourceFileEdit>> for SourceChange { |
40 | fn from(source_file_edits: Vec<SourceFileEdit>) -> SourceChange { | ||
41 | SourceChange { source_file_edits, file_system_edits: Vec::new(), is_snippet: false } | ||
51 | } | 42 | } |
52 | } | 43 | } |
53 | 44 | ||