refactor: switch StringBuilder capacity to size_hint
check / check (macos-latest) (push) Failing after 2m16s
check / check (ubuntu-latest) (push) Failing after 2m14s
check / check (windows-latest) (push) Failing after 14m21s

- Replace the StringBuilder(capacity=...) argument with size_hint=... in base32, base64, hex, SAM quoting/parsing.
- Drop trailing commas after the last field in I2NP, NTCP2 and tunnel fragment enum variants (formatter cleanup).
- No behavior change; encoded output and parsed fields are unchanged.
This commit is contained in:
nandi committed 2026-11-27 16:57:28 -08:00
1 parent cadb8cd898
commit 274bb319ab
7 files changed
+12 -12

No files matched your search

+3 -3
View File
@@ -69,7 +69,7 @@ fn quote_value(s : String) -> String {
if !needs_quoting(s) {
return s
}
let buf = StringBuilder(capacity=s.length() + 2)
let buf = StringBuilder(size_hint=s.length() + 2)
buf.write_char('"')
for ch in s {
if ch == '"' || ch == '\\' {
@@ -175,11 +175,11 @@ fn split_kv(token : String) -> (String, String)? {
if eq_idx <= 0 {
return None
}
let kbuf = StringBuilder(capacity=eq_idx)
let kbuf = StringBuilder(size_hint=eq_idx)
for i = 0; i < eq_idx; i = i + 1 {
kbuf.write_char(chars[i])
}
let vbuf = StringBuilder(capacity=chars.length() - eq_idx - 1)
let vbuf = StringBuilder(size_hint=chars.length() - eq_idx - 1)
for i = eq_idx + 1; i < chars.length(); i = i + 1 {
vbuf.write_char(chars[i])
}