Skip to content

Worktrunk is a CLI for Git worktree management, designed for parallel AI agent workflows

Simplify wt-perf truncate to plain ASCII slicing (#1953)

Maximilian Roos5143b087c535
diff --git a/tests/helpers/wt-perf/src/main.rs b/tests/helpers/wt-perf/src/main.rs
index f388992a9..af55afa33 100644
--- a/tests/helpers/wt-perf/src/main.rs
+++ b/tests/helpers/wt-perf/src/main.rs
@@ -252,16 +252,12 @@ To capture traces, run with RUST_LOG=debug:
entries
}
-/// Truncate a string for display, respecting UTF-8 char boundaries.
+/// Truncate an ASCII string for display, appending "..." if it exceeds `max` chars.
fn truncate(s: &str, max: usize) -> String {
if s.len() <= max {
s.to_string()
} else {
- let mut boundary = max - 3;
- while !s.is_char_boundary(boundary) {
- boundary -= 1;
- }
- format!("{}...", &s[..boundary])
+ format!("{}...", &s[..max - 3])
}
}