remove useless casts
This commit is contained in:
parent
aa90d02079
commit
bb083b8202
@ -131,7 +131,7 @@ fn scalar_max(scalar: &Scalar) -> i128 {
|
||||
IntTy::I16 => i16::MAX as i128,
|
||||
IntTy::I32 => i32::MAX as i128,
|
||||
IntTy::I64 => i64::MAX as i128,
|
||||
IntTy::I128 => i128::MAX as i128,
|
||||
IntTy::I128 => i128::MAX,
|
||||
},
|
||||
Scalar::Uint(x) => match x {
|
||||
chalk_ir::UintTy::Usize => usize::MAX as i128,
|
||||
@ -139,7 +139,7 @@ fn scalar_max(scalar: &Scalar) -> i128 {
|
||||
chalk_ir::UintTy::U16 => u16::MAX as i128,
|
||||
chalk_ir::UintTy::U32 => u32::MAX as i128,
|
||||
chalk_ir::UintTy::U64 => u64::MAX as i128,
|
||||
chalk_ir::UintTy::U128 => i128::MAX as i128, // ignore too big u128 for now
|
||||
chalk_ir::UintTy::U128 => i128::MAX, // ignore too big u128 for now
|
||||
},
|
||||
Scalar::Float(_) => 0,
|
||||
}
|
||||
|
@ -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)
|
||||
}
|
||||
};
|
||||
|
@ -161,8 +161,8 @@ pub(crate) fn new(id: String) -> Self {
|
||||
|
||||
/// 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 @@ pub(crate) fn push(&mut self, range: Range, token_index: u32, modifier_bitset: u
|
||||
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 {
|
||||
|
@ -51,7 +51,7 @@ fn write_u32(&mut self, i: u32) {
|
||||
}
|
||||
|
||||
fn write_u64(&mut self, i: u64) {
|
||||
self.0 = i as u64;
|
||||
self.0 = i;
|
||||
}
|
||||
|
||||
fn write_usize(&mut self, i: usize) {
|
||||
|
Loading…
Reference in New Issue
Block a user