Skip to content

Commit 6fef1a3

Browse files
authored
truncate instead of popping in a loop
1 parent 909eb3c commit 6fef1a3

1 file changed

Lines changed: 1 addition & 3 deletions

File tree

src/uu/date/src/format_modifiers.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -476,9 +476,7 @@ fn apply_modifiers(value: &str, parsed: &ParsedSpec<'_>) -> Result<String, Forma
476476
}
477477
} else if specifier.ends_with('N') {
478478
if effective_width <= get_default_width(specifier) {
479-
for _ in 0..result.len() - effective_width {
480-
result.pop();
481-
}
479+
result.truncate(3);
482480
}
483481
}
484482

0 commit comments

Comments
 (0)