remove useless casts

This commit is contained in:
Daniel Eades
2022-12-30 10:08:07 +00:00
parent aa90d02079
commit bb083b8202
4 changed files with 10 additions and 13 deletions

View File

@@ -25,12 +25,9 @@ pub(crate) fn vfs_path(url: &lsp_types::Url) -> Result<vfs::VfsPath> {
pub(crate) fn offset(line_index: &LineIndex, position: lsp_types::Position) -> Result<TextSize> {
let line_col = match line_index.encoding {
PositionEncoding::Utf8 => {
LineCol { line: position.line as u32, col: position.character as u32 }
}
PositionEncoding::Utf8 => LineCol { line: position.line, col: position.character },
PositionEncoding::Utf16 => {
let line_col =
LineColUtf16 { line: position.line as u32, col: position.character as u32 };
let line_col = LineColUtf16 { line: position.line, col: position.character };
line_index.index.to_utf8(line_col)
}
};

View File

@@ -161,8 +161,8 @@ impl SemanticTokensBuilder {
/// Push a new token onto the builder
pub(crate) fn push(&mut self, range: Range, token_index: u32, modifier_bitset: u32) {
let mut push_line = range.start.line as u32;
let mut push_char = range.start.character as u32;
let mut push_line = range.start.line;
let mut push_char = range.start.character;
if !self.data.is_empty() {
push_line -= self.prev_line;
@@ -177,15 +177,15 @@ impl SemanticTokensBuilder {
let token = SemanticToken {
delta_line: push_line,
delta_start: push_char,
length: token_len as u32,
length: token_len,
token_type: token_index,
token_modifiers_bitset: modifier_bitset,
};
self.data.push(token);
self.prev_line = range.start.line as u32;
self.prev_char = range.start.character as u32;
self.prev_line = range.start.line;
self.prev_char = range.start.character;
}
pub(crate) fn build(self) -> SemanticTokens {