aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_ide_db/src/source_change.rs
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2020-06-08 20:44:42 +0100
committerAleksey Kladov <[email protected]>2020-06-08 20:48:23 +0100
commit2a42904680041664621034c22c3f600a47107a5a (patch)
tree2e97754c3295a7fba7b36e03695fd11b85b5d149 /crates/ra_ide_db/src/source_change.rs
parent3a7c218fd40c77246c94d28b36b1c567492e5bcb (diff)
Simplify
Diffstat (limited to 'crates/ra_ide_db/src/source_change.rs')
-rw-r--r--crates/ra_ide_db/src/source_change.rs23
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
44impl From<SourceFileEdit> for SourceChange { 33impl 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 } 39impl 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