diff --git a/.jules/bolt.md b/.jules/bolt.md new file mode 100644 index 00000000..aa059c8f --- /dev/null +++ b/.jules/bolt.md @@ -0,0 +1,3 @@ +## 2024-05-23 - Verifying multiline code segments for optimizations +**Learning:** Standard grep queries for multiline code snippets (like `collect::>().join("")`) often fail because they search line-by-line, causing missed opportunities or unverified code edits. Rust code formatting frequently breaks method chains across multiple lines. +**Action:** Always use tools like `sed -n 'start,endp' file`, `cat` with manual inspection, or `grep -C` to verify the exact structure of multiline code blocks *before* creating a plan to modify them with `replace_with_git_merge_diff`. diff --git a/xdk-lib/src/casing.rs b/xdk-lib/src/casing.rs index 6463487e..bd04c567 100644 --- a/xdk-lib/src/casing.rs +++ b/xdk-lib/src/casing.rs @@ -29,11 +29,7 @@ impl Casing { result } } - Casing::Pascal => words - .iter() - .map(|w| pascal_case(w)) - .collect::>() - .join(""), + Casing::Pascal => words.iter().map(|w| pascal_case(w)).collect::(), Casing::Kebab => words.join("-").to_lowercase(), Casing::ScreamingSnake => words.join("_").to_uppercase(), } @@ -118,6 +114,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(), } }