aboutsummaryrefslogtreecommitdiff
path: root/crates
diff options
context:
space:
mode:
authorJeremy A. Kolb <[email protected]>2018-10-04 14:39:02 +0100
committerJeremy A. Kolb <[email protected]>2018-10-04 14:39:02 +0100
commita30039ba625b857ee91e63d5af51e3b8cb824615 (patch)
tree1deacdb83c0e7bf099b863927ae1ddb81a6e4422 /crates
parent334d266b7704419a6122b283a740c7baa36695b4 (diff)
Pull casts out of TextUnit
Diffstat (limited to 'crates')
-rw-r--r--crates/ra_editor/src/extend_selection.rs8
1 files 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
47 let cursor_position: u32 = (offset - leaf.range().start()).into(); 47 let cursor_position: u32 = (offset - leaf.range().start()).into();
48 48
49 let (before, after) = text.split_at(cursor_position as usize); 49 let (before, after) = text.split_at(cursor_position as usize);
50 let start_idx = before.rfind(char::is_whitespace)?; 50 let start_idx = before.rfind(char::is_whitespace)? as u32;
51 let end_idx = after.find(char::is_whitespace)?; 51 let end_idx = after.find(char::is_whitespace)? as u32;
52 52
53 let from : TextUnit = (start_idx as u32 + 1).into(); 53 let from : TextUnit = (start_idx + 1).into();
54 let to : TextUnit = (cursor_position + (end_idx as u32)).into(); 54 let to : TextUnit = (cursor_position + end_idx).into();
55 55
56 Some(TextRange::from_to(from, to)) 56 Some(TextRange::from_to(from, to))
57} 57}