Skip to content

Commit ae0f684

Browse files
Refactor label
seem counter-intuitive but it helps to ensure that pushing to the label reallocates Co-authored-by: Maciej Hirsz <[email protected]>
1 parent 407768a commit ae0f684

File tree

1 file changed

+2
-1
lines changed
  • frameworks/non-keyed/kobold/src

1 file changed

+2
-1
lines changed

frameworks/non-keyed/kobold/src/lib.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,8 @@ impl State {
7474
let adjective = ADJECTIVES[random(ADJECTIVES_LEN)];
7575
let colour = COLOURS[random(COLOURS_LEN)];
7676
let noun = NOUNS[random(NOUNS_LEN)];
77-
let mut label = String::with_capacity(adjective.len() + colour.len() + noun.len() + 2);
77+
let mut label = String::new();
78+
label.reserve_exact(adjective.len() + colour.len() + noun.len() + 2);
7879
label.push_str(adjective);
7980
label.push(' ');
8081
label.push_str(colour);

0 commit comments

Comments
 (0)