From df00da15c435f3105007146cbbfc9afc34ad311c Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Tue, 5 May 2020 20:44:13 +0200 Subject: Fix compilation --- crates/ra_assists/src/lib.rs | 2 +- crates/ra_ide/src/assists.rs | 19 +++++++------------ 2 files changed, 8 insertions(+), 13 deletions(-) diff --git a/crates/ra_assists/src/lib.rs b/crates/ra_assists/src/lib.rs index 1b31d655b..5cec10088 100644 --- a/crates/ra_assists/src/lib.rs +++ b/crates/ra_assists/src/lib.rs @@ -17,13 +17,13 @@ mod doc_tests; pub mod utils; pub mod ast_transform; +use hir::Semantics; use ra_db::{FileId, FileRange}; use ra_ide_db::RootDatabase; use ra_syntax::{TextRange, TextSize}; use ra_text_edit::TextEdit; pub(crate) use crate::assist_ctx::{Assist, AssistCtx, AssistHandler}; -use hir::Semantics; /// Unique identifier of the assist, should not be shown to the user /// directly. diff --git a/crates/ra_ide/src/assists.rs b/crates/ra_ide/src/assists.rs index 2b5d11681..389339a03 100644 --- a/crates/ra_ide/src/assists.rs +++ b/crates/ra_ide/src/assists.rs @@ -1,6 +1,6 @@ //! FIXME: write short doc here -use ra_assists::{resolved_assists, AssistAction, AssistLabel}; +use ra_assists::{resolved_assists, AssistAction}; use ra_db::{FilePosition, FileRange}; use ra_ide_db::RootDatabase; @@ -21,27 +21,22 @@ pub(crate) fn assists(db: &RootDatabase, frange: FileRange) -> Vec { .into_iter() .map(|assist| { let file_id = frange.file_id; - let assist_label = &assist.label; Assist { - id: assist_label.id, - label: assist_label.label.clone(), - group_label: assist.group_label.map(|it| it.0), - source_change: action_to_edit(assist.action, file_id, assist_label), + id: assist.label.id, + label: assist.label.label.clone(), + group_label: assist.label.group.map(|it| it.0), + source_change: action_to_edit(assist.action, file_id, assist.label.label.clone()), } }) .collect() } -fn action_to_edit( - action: AssistAction, - file_id: FileId, - assist_label: &AssistLabel, -) -> SourceChange { +fn action_to_edit(action: AssistAction, file_id: FileId, label: String) -> SourceChange { let file_id = match action.file { ra_assists::AssistFile::TargetFile(it) => it, _ => file_id, }; let file_edit = SourceFileEdit { file_id, edit: action.edit }; - SourceChange::source_file_edit(assist_label.label.clone(), file_edit) + SourceChange::source_file_edit(label, file_edit) .with_cursor_opt(action.cursor_position.map(|offset| FilePosition { offset, file_id })) } -- cgit v1.2.3