Use floor_char_boundary for log truncation
The pinned toolchain is 1.94, so the standard library helper replaces the hand-written boundary loop. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Co-Authored-By: siGit Code v1.5.11 <noreply@sigit.si>
Seto Elkahfi committed
Oct 1, 2026 at 20:12 UTC
57ba7d97bbeea13f16b513e33c6181883656d0a5
1 file changed
+1
-5
src/inference/engine.rs
+1
-5
@@ -2096,11 +2096,7 @@ fn chat_role_to_mistral(role: &ChatRole) -> TextMessageRole {
2096
/// Truncate a string for log output, appending `"..."` if truncated.
2097
fn truncate_for_log(s: &str, max_len: usize) -> String {
2098
if s.len() > max_len {
2099
- let mut end = max_len;
2100
- while !s.is_char_boundary(end) {
2101
- end -= 1;
2102
- }
2103
- format!("{}...", &s[..end])
2099
+ format!("{}...", &s[..s.floor_char_boundary(max_len)])
2100
} else {
2101
s.to_string()
2102
}