From 3aa7a13ec0141e1d39193df37ee39d279c8c2217 Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Sun, 28 Jun 2026 21:19:33 +0000 Subject: [PATCH] =?UTF-8?q?=E2=9A=A1=20Bolt:=20[performance=20improvement]?= =?UTF-8?q?=20Optimize=20PascalCase=20conversion=20by=20removing=20interme?= =?UTF-8?q?diate=20Vec=20allocation?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Refactored `xdk-lib/src/casing.rs` to avoid allocating an intermediate `Vec` when collecting iterators into a `String`, utilizing `.collect::()` and `.to_string()` directly. Co-authored-by: cloudesize67-cmd <237356855+cloudesize67-cmd@users.noreply.github.com> --- xdk-lib/src/casing.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/xdk-lib/src/casing.rs b/xdk-lib/src/casing.rs index 6463487e..ec2a3d3b 100644 --- a/xdk-lib/src/casing.rs +++ b/xdk-lib/src/casing.rs @@ -32,8 +32,8 @@ impl Casing { Casing::Pascal => words .iter() .map(|w| pascal_case(w)) - .collect::>() - .join(""), + // Bolt optimization: use collect::() directly to avoid intermediate Vec allocation + .collect::(), Casing::Kebab => words.join("-").to_lowercase(), Casing::ScreamingSnake => words.join("_").to_uppercase(), } @@ -118,6 +118,6 @@ pub fn camel_case(value: &str) -> String { let mut chars = pascal.chars(); match chars.next() { None => String::new(), - Some(first) => first.to_lowercase().collect::() + chars.as_str(), + Some(first) => first.to_lowercase().to_string() + chars.as_str(), // Bolt optimization: avoid iterator collection } }