diff --git a/crates/ra_assists/src/lib.rs b/crates/ra_assists/src/lib.rs index 1b31d655b1e..5cec10088ce 100644 --- a/crates/ra_assists/src/lib.rs +++ b/crates/ra_assists/src/lib.rs @@ -17,13 +17,13 @@ macro_rules! eprintln { 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 2b5d11681af..389339a0344 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 })) }