From a30039ba625b857ee91e63d5af51e3b8cb824615 Mon Sep 17 00:00:00 2001 From: "Jeremy A. Kolb" Date: Thu, 4 Oct 2018 09:39:02 -0400 Subject: Pull casts out of TextUnit --- crates/ra_editor/src/extend_selection.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/crates/ra_editor/src/extend_selection.rs b/crates/ra_editor/src/extend_selection.rs index a6cb1acf5..6977900e6 100644 --- a/crates/ra_editor/src/extend_selection.rs +++ b/crates/ra_editor/src/extend_selection.rs @@ -47,11 +47,11 @@ fn extend_single_word_in_comment(leaf: SyntaxNodeRef, offset: TextUnit) -> Optio let cursor_position: u32 = (offset - leaf.range().start()).into(); let (before, after) = text.split_at(cursor_position as usize); - let start_idx = before.rfind(char::is_whitespace)?; - let end_idx = after.find(char::is_whitespace)?; + let start_idx = before.rfind(char::is_whitespace)? as u32; + let end_idx = after.find(char::is_whitespace)? as u32; - let from : TextUnit = (start_idx as u32 + 1).into(); - let to : TextUnit = (cursor_position + (end_idx as u32)).into(); + let from : TextUnit = (start_idx + 1).into(); + let to : TextUnit = (cursor_position + end_idx).into(); Some(TextRange::from_to(from, to)) } -- cgit v1.2.3