From 3a055a6b1fc44602ab346a0f2f984674931a8456 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Mon, 30 Aug 2021 10:25:44 +0300 Subject: [PATCH] internal: make upstream bug less annoying --- crates/rust-analyzer/src/handlers.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/crates/rust-analyzer/src/handlers.rs b/crates/rust-analyzer/src/handlers.rs index d196db6f591..699a805eb01 100644 --- a/crates/rust-analyzer/src/handlers.rs +++ b/crates/rust-analyzer/src/handlers.rs @@ -7,7 +7,6 @@ use std::{ process::{self, Stdio}, }; -use always_assert::always; use ide::{ AnnotationConfig, AssistKind, AssistResolveStrategy, FileId, FilePosition, FileRange, HoverAction, HoverGotoTypeData, Query, RangeInfo, Runnable, RunnableKind, SingleResolve, @@ -268,7 +267,9 @@ pub(crate) fn handle_on_type_formatting( let char_typed = params.ch.chars().next().unwrap_or('\0'); let text = snap.analysis.file_text(position.file_id)?; - if !always!(text[usize::from(position.offset)..].starts_with(char_typed)) { + if !text[usize::from(position.offset)..].starts_with(char_typed) { + // Add `always!` here once VS Code bug is fixed: + // https://github.com/rust-analyzer/rust-analyzer/issues/10002 return Ok(None); }