4547: Remove unused cursor positions r=matklad a=matklad



bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
This commit is contained in:
bors[bot] 2020-05-21 08:38:55 +00:00 committed by GitHub
commit a4e6963a23
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 3 additions and 8 deletions

View file

@ -248,8 +248,7 @@ impl AssistBuilder {
fn finish(self, change_label: String) -> SourceChange {
let edit = self.edit.finish();
let mut res = SingleFileChange { label: change_label, edit, cursor_position: None }
.into_source_change(self.file);
let mut res = SingleFileChange { label: change_label, edit }.into_source_change(self.file);
if self.is_snippet {
res.is_snippet = true;
}

View file

@ -82,7 +82,6 @@ fn on_eq_typed(file: &SourceFile, offset: TextSize) -> Option<SingleFileChange>
Some(SingleFileChange {
label: "add semicolon".to_string(),
edit: TextEdit::insert(offset, ";".to_string()),
cursor_position: None,
})
}
@ -111,7 +110,6 @@ fn on_dot_typed(file: &SourceFile, offset: TextSize) -> Option<SingleFileChange>
Some(SingleFileChange {
label: "reindent dot".to_string(),
edit: TextEdit::replace(TextRange::new(offset - current_indent_len, offset), target_indent),
cursor_position: None,
})
}
@ -130,7 +128,6 @@ fn on_arrow_typed(file: &SourceFile, offset: TextSize) -> Option<SingleFileChang
Some(SingleFileChange {
label: "add space after return type".to_string(),
edit: TextEdit::insert(after_arrow, " ".to_string()),
cursor_position: None,
})
}

View file

@ -4,7 +4,7 @@
//! It can be viewed as a dual for `AnalysisChange`.
use ra_db::{FileId, FilePosition, RelativePathBuf, SourceRootId};
use ra_text_edit::{TextEdit, TextSize};
use ra_text_edit::TextEdit;
#[derive(Debug, Clone)]
pub struct SourceChange {
@ -109,7 +109,6 @@ pub enum FileSystemEdit {
pub struct SingleFileChange {
pub label: String,
pub edit: TextEdit,
pub cursor_position: Option<TextSize>,
}
impl SingleFileChange {
@ -118,7 +117,7 @@ impl SingleFileChange {
label: self.label,
source_file_edits: vec![SourceFileEdit { file_id, edit: self.edit }],
file_system_edits: Vec::new(),
cursor_position: self.cursor_position.map(|offset| FilePosition { file_id, offset }),
cursor_position: None,
is_snippet: false,
}
}