mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-01 11:31:15 +00:00
Pull casts out of TextUnit
This commit is contained in:
parent
334d266b77
commit
a30039ba62
@ -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 cursor_position: u32 = (offset - leaf.range().start()).into();
|
||||||
|
|
||||||
let (before, after) = text.split_at(cursor_position as usize);
|
let (before, after) = text.split_at(cursor_position as usize);
|
||||||
let start_idx = before.rfind(char::is_whitespace)?;
|
let start_idx = before.rfind(char::is_whitespace)? as u32;
|
||||||
let end_idx = after.find(char::is_whitespace)?;
|
let end_idx = after.find(char::is_whitespace)? as u32;
|
||||||
|
|
||||||
let from : TextUnit = (start_idx as u32 + 1).into();
|
let from : TextUnit = (start_idx + 1).into();
|
||||||
let to : TextUnit = (cursor_position + (end_idx as u32)).into();
|
let to : TextUnit = (cursor_position + end_idx).into();
|
||||||
|
|
||||||
Some(TextRange::from_to(from, to))
|
Some(TextRange::from_to(from, to))
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user