Skip to content

Commit 9889c05

Browse files
committed
ls: avoid string allocation for indicator char
1 parent c8b0a2f commit 9889c05

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

src/uu/ls/src/ls.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3437,7 +3437,8 @@ fn display_item_name(
34373437
};
34383438

34393439
if let Some(c) = char_opt {
3440-
name.push(OsStr::new(&c.to_string()));
3440+
let mut buf = [0u8; 4];
3441+
name.push(OsStr::new(c.encode_utf8(&mut buf)));
34413442
}
34423443
}
34433444

0 commit comments

Comments
 (0)