From 2a42904680041664621034c22c3f600a47107a5a Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Mon, 8 Jun 2020 21:44:42 +0200 Subject: Simplify --- crates/ra_ide_db/src/source_change.rs | 23 +++++++---------------- 1 file changed, 7 insertions(+), 16 deletions(-) (limited to 'crates/ra_ide_db/src') 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 { ) -> Self { SourceChange { source_file_edits, file_system_edits, is_snippet: false } } - - /// Creates a new SourceChange with the given label, - /// containing only the given `SourceFileEdits`. - pub fn source_file_edits(edits: Vec) -> Self { - SourceChange { source_file_edits: edits, file_system_edits: vec![], is_snippet: false } - } - /// Creates a new SourceChange with the given label - /// from the given `FileId` and `TextEdit` - pub fn source_file_edit_from(file_id: FileId, edit: TextEdit) -> Self { - SourceFileEdit { file_id, edit }.into() - } } #[derive(Debug, Clone)] @@ -43,11 +32,13 @@ pub struct SourceFileEdit { impl From for SourceChange { fn from(edit: SourceFileEdit) -> SourceChange { - SourceChange { - source_file_edits: vec![edit], - file_system_edits: Vec::new(), - is_snippet: false, - } + vec![edit].into() + } +} + +impl From> for SourceChange { + fn from(source_file_edits: Vec) -> SourceChange { + SourceChange { source_file_edits, file_system_edits: Vec::new(), is_snippet: false } } } -- cgit v1.2.3