Skip to content

Commit 5d61731

Browse files
committed
fix off by one in alloc check
no UB, but caused allocations when cap would fit in remaining
1 parent 33a6b5a commit 5d61731

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

crates/types/src/string.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ impl StringBuilder {
204204
return;
205205
}
206206
let remaining = self.remaining_capacity();
207-
if remaining > cap {
207+
if remaining >= cap {
208208
return;
209209
}
210210
let needed_space =

0 commit comments

Comments
 (0)