aboutsummaryrefslogtreecommitdiff
path: root/crates
diff options
context:
space:
mode:
Diffstat (limited to 'crates')
-rw-r--r--crates/ra_ide_api/src/assists.rs2
-rw-r--r--crates/ra_ide_api/src/diagnostics.rs4
-rw-r--r--crates/ra_ide_api/src/lib.rs12
-rw-r--r--crates/ra_ide_api/src/references.rs2
-rw-r--r--crates/ra_ide_api/src/typing.rs2
5 files changed, 11 insertions, 11 deletions
diff --git a/crates/ra_ide_api/src/assists.rs b/crates/ra_ide_api/src/assists.rs
index 9a8c23a15..355c0a42a 100644
--- a/crates/ra_ide_api/src/assists.rs
+++ b/crates/ra_ide_api/src/assists.rs
@@ -17,7 +17,7 @@ pub(crate) fn assists(db: &RootDatabase, frange: FileRange) -> Vec<Assist> {
17 let file_id = frange.file_id; 17 let file_id = frange.file_id;
18 let file_edit = SourceFileEdit { file_id, edit: action.edit }; 18 let file_edit = SourceFileEdit { file_id, edit: action.edit };
19 let id = label.id; 19 let id = label.id;
20 let change = SourceChange::source_edit(label.label, file_edit).with_cursor_opt( 20 let change = SourceChange::source_file_edit(label.label, file_edit).with_cursor_opt(
21 action.cursor_position.map(|offset| FilePosition { offset, file_id }), 21 action.cursor_position.map(|offset| FilePosition { offset, file_id }),
22 ); 22 );
23 Assist { id, change } 23 Assist { id, change }
diff --git a/crates/ra_ide_api/src/diagnostics.rs b/crates/ra_ide_api/src/diagnostics.rs
index 6559de29d..156f28ca3 100644
--- a/crates/ra_ide_api/src/diagnostics.rs
+++ b/crates/ra_ide_api/src/diagnostics.rs
@@ -71,7 +71,7 @@ fn check_unnecessary_braces_in_use_statement(
71 range, 71 range,
72 message: format!("Unnecessary braces in use statement"), 72 message: format!("Unnecessary braces in use statement"),
73 severity: Severity::WeakWarning, 73 severity: Severity::WeakWarning,
74 fix: Some(SourceChange::source_edit( 74 fix: Some(SourceChange::source_file_edit(
75 "Remove unnecessary braces", 75 "Remove unnecessary braces",
76 SourceFileEdit { file_id, edit }, 76 SourceFileEdit { file_id, edit },
77 )), 77 )),
@@ -117,7 +117,7 @@ fn check_struct_shorthand_initialization(
117 range: named_field.syntax().range(), 117 range: named_field.syntax().range(),
118 message: format!("Shorthand struct initialization"), 118 message: format!("Shorthand struct initialization"),
119 severity: Severity::WeakWarning, 119 severity: Severity::WeakWarning,
120 fix: Some(SourceChange::source_edit( 120 fix: Some(SourceChange::source_file_edit(
121 "use struct shorthand initialization", 121 "use struct shorthand initialization",
122 SourceFileEdit { file_id, edit }, 122 SourceFileEdit { file_id, edit },
123 )), 123 )),
diff --git a/crates/ra_ide_api/src/lib.rs b/crates/ra_ide_api/src/lib.rs
index 928f3d604..8aa3eb088 100644
--- a/crates/ra_ide_api/src/lib.rs
+++ b/crates/ra_ide_api/src/lib.rs
@@ -115,7 +115,7 @@ impl SourceChange {
115 115
116 /// Creates a new SourceChange with the given label, 116 /// Creates a new SourceChange with the given label,
117 /// containing only the given `SourceFileEdits`. 117 /// containing only the given `SourceFileEdits`.
118 pub(crate) fn source_edits<L: Into<String>>(label: L, edits: Vec<SourceFileEdit>) -> Self { 118 pub(crate) fn source_file_edits<L: Into<String>>(label: L, edits: Vec<SourceFileEdit>) -> Self {
119 SourceChange { 119 SourceChange {
120 label: label.into(), 120 label: label.into(),
121 source_file_edits: edits, 121 source_file_edits: edits,
@@ -137,8 +137,8 @@ impl SourceChange {
137 137
138 /// Creates a new SourceChange with the given label, 138 /// Creates a new SourceChange with the given label,
139 /// containing only a single `SourceFileEdit`. 139 /// containing only a single `SourceFileEdit`.
140 pub(crate) fn source_edit<L: Into<String>>(label: L, edit: SourceFileEdit) -> Self { 140 pub(crate) fn source_file_edit<L: Into<String>>(label: L, edit: SourceFileEdit) -> Self {
141 SourceChange::source_edits(label, vec![edit]) 141 SourceChange::source_file_edits(label, vec![edit])
142 } 142 }
143 143
144 /// Creates a new SourceChange with the given label 144 /// Creates a new SourceChange with the given label
@@ -148,7 +148,7 @@ impl SourceChange {
148 file_id: FileId, 148 file_id: FileId,
149 edit: TextEdit, 149 edit: TextEdit,
150 ) -> Self { 150 ) -> Self {
151 SourceChange::source_edit(label, SourceFileEdit { file_id, edit }) 151 SourceChange::source_file_edit(label, SourceFileEdit { file_id, edit })
152 } 152 }
153 153
154 /// Creates a new SourceChange with the given label 154 /// Creates a new SourceChange with the given label
@@ -358,7 +358,7 @@ impl Analysis {
358 file_id: frange.file_id, 358 file_id: frange.file_id,
359 edit: join_lines::join_lines(&file, frange.range), 359 edit: join_lines::join_lines(&file, frange.range),
360 }; 360 };
361 SourceChange::source_edit("join lines", file_edit) 361 SourceChange::source_file_edit("join lines", file_edit)
362 } 362 }
363 363
364 /// Returns an edit which should be applied when opening a new line, fixing 364 /// Returns an edit which should be applied when opening a new line, fixing
@@ -373,7 +373,7 @@ impl Analysis {
373 pub fn on_eq_typed(&self, position: FilePosition) -> Option<SourceChange> { 373 pub fn on_eq_typed(&self, position: FilePosition) -> Option<SourceChange> {
374 let file = self.db.parse(position.file_id); 374 let file = self.db.parse(position.file_id);
375 let edit = typing::on_eq_typed(&file, position.offset)?; 375 let edit = typing::on_eq_typed(&file, position.offset)?;
376 Some(SourceChange::source_edit( 376 Some(SourceChange::source_file_edit(
377 "add semicolon", 377 "add semicolon",
378 SourceFileEdit { edit, file_id: position.file_id }, 378 SourceFileEdit { edit, file_id: position.file_id },
379 )) 379 ))
diff --git a/crates/ra_ide_api/src/references.rs b/crates/ra_ide_api/src/references.rs
index 78f77e761..22741445a 100644
--- a/crates/ra_ide_api/src/references.rs
+++ b/crates/ra_ide_api/src/references.rs
@@ -206,7 +206,7 @@ fn rename_reference(
206 return None; 206 return None;
207 } 207 }
208 208
209 Some(SourceChange::source_edits("rename", edit)) 209 Some(SourceChange::source_file_edits("rename", edit))
210} 210}
211 211
212#[cfg(test)] 212#[cfg(test)]
diff --git a/crates/ra_ide_api/src/typing.rs b/crates/ra_ide_api/src/typing.rs
index aa9971450..501d44dbb 100644
--- a/crates/ra_ide_api/src/typing.rs
+++ b/crates/ra_ide_api/src/typing.rs
@@ -33,7 +33,7 @@ pub(crate) fn on_enter(db: &RootDatabase, position: FilePosition) -> Option<Sour
33 edit.insert(position.offset, inserted); 33 edit.insert(position.offset, inserted);
34 34
35 Some( 35 Some(
36 SourceChange::source_edit( 36 SourceChange::source_file_edit(
37 "on enter", 37 "on enter",
38 SourceFileEdit { edit: edit.finish(), file_id: position.file_id }, 38 SourceFileEdit { edit: edit.finish(), file_id: position.file_id },
39 ) 39 )