next.js
a244a43c - Extract repeat_char_into helper for efficient character repetition

Commit
49 days ago
Extract repeat_char_into helper for efficient character repetition Created a reusable helper function that: - Pre-reserves capacity to avoid multiple allocations - Pushes characters directly into the buffer - Marked inline for zero-cost abstraction Applied to all 3 repetition sites: 1. Message indentation (gutter_total_width spaces) 2. Marker column spacing (marker_col - 1 spaces) 3. Error marker carets (marker_length '^' chars) Benefits: - Single implementation of the optimization pattern - Easier to maintain and understand - Better performance with upfront reservation - Cleaner call sites Example: ```rust // Before output.push_str(&" ".repeat(gutter_total_width)); // After repeat_char_into(&mut output, ' ', gutter_total_width); ``` All 20 tests passing. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Author
Committer
Parents
Loading