From d3b96411250a176f048cc039cf9077c4d6b13a60 Mon Sep 17 00:00:00 2001 From: jneem Date: Sat, 14 Sep 2024 04:17:23 +0700 Subject: [PATCH] Remove bad assert. (#11) We reserve bufmaxlen bytes in the string, but then proceed to push up to bufmaxlen chars. Therefore it is possible that the string will need to reallocate. A different solution would be to reserve 4*bufmaxlen bytes. Removing the assert is probably ok, because the attempt to pre-allocate is just a performance optimization. --- parser/src/scanner.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/parser/src/scanner.rs b/parser/src/scanner.rs index 1f4a2bb..13849aa 100644 --- a/parser/src/scanner.rs +++ b/parser/src/scanner.rs @@ -2230,7 +2230,6 @@ impl Scanner { end = true; break; } - assert!(string.len() < string.capacity()); string.push(self.input.peek()); self.skip_non_blank(); }