diff options
author | bors[bot] <bors[bot]@users.noreply.github.com> | 2019-01-03 16:08:52 +0000 |
---|---|---|
committer | bors[bot] <bors[bot]@users.noreply.github.com> | 2019-01-03 16:08:52 +0000 |
commit | 33924c0939bb64cdb6fc4644582411a7be1f135d (patch) | |
tree | ea555719a2ec8574f5399de896b9c4e2586c7270 /crates/ra_analysis/src | |
parent | 5443205fdd9f4886cc88ad15c3a6061ffa90ca19 (diff) | |
parent | 6be39ba758eade2a20ab6384127a2b1ca48ca9ce (diff) |
Merge #416
416: assist-builder r=matklad a=matklad
Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'crates/ra_analysis/src')
-rw-r--r-- | crates/ra_analysis/src/imp.rs | 16 |
1 files changed, 3 insertions, 13 deletions
diff --git a/crates/ra_analysis/src/imp.rs b/crates/ra_analysis/src/imp.rs index 136e7f7dc..771dad475 100644 --- a/crates/ra_analysis/src/imp.rs +++ b/crates/ra_analysis/src/imp.rs | |||
@@ -333,19 +333,9 @@ impl db::RootDatabase { | |||
333 | 333 | ||
334 | pub(crate) fn assists(&self, frange: FileRange) -> Vec<SourceChange> { | 334 | pub(crate) fn assists(&self, frange: FileRange) -> Vec<SourceChange> { |
335 | let file = self.source_file(frange.file_id); | 335 | let file = self.source_file(frange.file_id); |
336 | let offset = frange.range.start(); | 336 | assists::assists(&file, frange.range) |
337 | let actions = vec![ | ||
338 | assists::flip_comma(&file, offset).map(|f| f()), | ||
339 | assists::add_derive(&file, offset).map(|f| f()), | ||
340 | assists::add_impl(&file, offset).map(|f| f()), | ||
341 | assists::change_visibility(&file, offset).map(|f| f()), | ||
342 | assists::introduce_variable(&file, frange.range).map(|f| f()), | ||
343 | ]; | ||
344 | actions | ||
345 | .into_iter() | 337 | .into_iter() |
346 | .filter_map(|local_edit| { | 338 | .map(|local_edit| SourceChange::from_local_edit(frange.file_id, local_edit)) |
347 | Some(SourceChange::from_local_edit(frange.file_id, local_edit?)) | ||
348 | }) | ||
349 | .collect() | 339 | .collect() |
350 | } | 340 | } |
351 | 341 | ||
@@ -440,7 +430,7 @@ impl db::RootDatabase { | |||
440 | .map(|(file_id, text_range)| SourceFileEdit { | 430 | .map(|(file_id, text_range)| SourceFileEdit { |
441 | file_id: *file_id, | 431 | file_id: *file_id, |
442 | edit: { | 432 | edit: { |
443 | let mut builder = ra_text_edit::TextEditBuilder::new(); | 433 | let mut builder = ra_text_edit::TextEditBuilder::default(); |
444 | builder.replace(*text_range, new_name.into()); | 434 | builder.replace(*text_range, new_name.into()); |
445 | builder.finish() | 435 | builder.finish() |
446 | }, | 436 | }, |