From 8dc68ecdfcc764c7c0dcf5fcedcb51b092d99620 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Thu, 14 Jan 2021 18:25:19 +0300 Subject: Introduce more appropriate assertion mechanism rust-analyzer is a long-running program, so we *should* handle assertion failures. See also https://www.sqlite.org/assert.html. --- crates/completion/src/item.rs | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'crates/completion/src/item.rs') diff --git a/crates/completion/src/item.rs b/crates/completion/src/item.rs index 35af354b0..0134ff219 100644 --- a/crates/completion/src/item.rs +++ b/crates/completion/src/item.rs @@ -7,6 +7,7 @@ use ide_db::helpers::{ insert_use::{self, ImportScope, MergeBehavior}, mod_path_to_ast, SnippetCap, }; +use stdx::assert_never; use syntax::{algo, TextRange}; use text_edit::TextEdit; @@ -396,6 +397,9 @@ impl Builder { } pub(crate) fn set_detail(mut self, detail: Option>) -> Builder { self.detail = detail.map(Into::into); + if let Some(detail) = &self.detail { + assert_never!(detail.contains('\n'), "multiline detail: {}", detail); + } self } #[allow(unused)] -- cgit v1.2.3