aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_ide/src/completion/complete_postfix.rs
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2020-04-24 22:40:41 +0100
committerAleksey Kladov <[email protected]>2020-04-25 10:59:18 +0100
commitb1d5817dd18b7b5fc102a63b084b1ee7ff4f9996 (patch)
treee5d136c5ba4a6ba96aeeb423e6e3f64ca7cea3f9 /crates/ra_ide/src/completion/complete_postfix.rs
parent27a7718880d93f55f905da606d108d3b3c682ab4 (diff)
Convert code to text-size
Diffstat (limited to 'crates/ra_ide/src/completion/complete_postfix.rs')
-rw-r--r--crates/ra_ide/src/completion/complete_postfix.rs6
1 files changed, 3 insertions, 3 deletions
diff --git a/crates/ra_ide/src/completion/complete_postfix.rs b/crates/ra_ide/src/completion/complete_postfix.rs
index 8d397b0fe..d6a37d720 100644
--- a/crates/ra_ide/src/completion/complete_postfix.rs
+++ b/crates/ra_ide/src/completion/complete_postfix.rs
@@ -2,7 +2,7 @@
2 2
3use ra_syntax::{ 3use ra_syntax::{
4 ast::{self, AstNode}, 4 ast::{self, AstNode},
5 TextRange, TextUnit, 5 TextRange, TextSize,
6}; 6};
7use ra_text_edit::TextEdit; 7use ra_text_edit::TextEdit;
8 8
@@ -115,7 +115,7 @@ pub(super) fn complete_postfix(acc: &mut Completions, ctx: &CompletionContext) {
115fn get_receiver_text(receiver: &ast::Expr, receiver_is_ambiguous_float_literal: bool) -> String { 115fn get_receiver_text(receiver: &ast::Expr, receiver_is_ambiguous_float_literal: bool) -> String {
116 if receiver_is_ambiguous_float_literal { 116 if receiver_is_ambiguous_float_literal {
117 let text = receiver.syntax().text(); 117 let text = receiver.syntax().text();
118 let without_dot = ..text.len() - TextUnit::of_char('.'); 118 let without_dot = ..text.len() - TextSize::of('.');
119 text.slice(without_dot).to_string() 119 text.slice(without_dot).to_string()
120 } else { 120 } else {
121 receiver.to_string() 121 receiver.to_string()
@@ -143,7 +143,7 @@ fn postfix_snippet(
143 let edit = { 143 let edit = {
144 let receiver_syntax = receiver.syntax(); 144 let receiver_syntax = receiver.syntax();
145 let receiver_range = ctx.sema.original_range(receiver_syntax).range; 145 let receiver_range = ctx.sema.original_range(receiver_syntax).range;
146 let delete_range = TextRange::from_to(receiver_range.start(), ctx.source_range().end()); 146 let delete_range = TextRange::new(receiver_range.start(), ctx.source_range().end());
147 TextEdit::replace(delete_range, snippet.to_string()) 147 TextEdit::replace(delete_range, snippet.to_string())
148 }; 148 };
149 CompletionItem::new(CompletionKind::Postfix, ctx.source_range(), label) 149 CompletionItem::new(CompletionKind::Postfix, ctx.source_range(), label)