From d3b700f98cfd96df3ad7ca018a5e7e3d0ea96429 Mon Sep 17 00:00:00 2001 From: Johannes Altmanninger Date: Wed, 14 Feb 2024 22:24:39 +0100 Subject: [PATCH] Promote debug-only assertion --- src/builtins/string.rs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/builtins/string.rs b/src/builtins/string.rs index 994ca4aff..de6262e07 100644 --- a/src/builtins/string.rs +++ b/src/builtins/string.rs @@ -262,9 +262,7 @@ fn width_without_escapes(ins: &wstr, start_pos: usize) -> usize { pos += 1; } } - // we subtracted less than we added - debug_assert!(width >= 0, "line has negative width"); - return width as usize; + usize::try_from(width).expect("line has negative width") } /// Empirically determined.