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.
This commit is contained in:
jneem 2024-09-14 04:17:23 +07:00 committed by GitHub
parent e215f546f3
commit d3b9641125

View file

@ -2230,7 +2230,6 @@ impl<T: Input> Scanner<T> {
end = true; end = true;
break; break;
} }
assert!(string.len() < string.capacity());
string.push(self.input.peek()); string.push(self.input.peek());
self.skip_non_blank(); self.skip_non_blank();
} }