mirror of
https://github.com/rust-lang/rust.git
synced 2026-05-22 02:00:00 +03:00
core: Use substr in extfmt instead of slice_bytes
This commit is contained in:
@@ -321,13 +321,12 @@ fn conv_str(cv: conv, s: str) -> str unsafe {
|
||||
// For strings, precision is the maximum characters
|
||||
// displayed
|
||||
|
||||
// FIXME: substr works on bytes, not chars!
|
||||
let unpadded =
|
||||
alt cv.precision {
|
||||
count_implied { s }
|
||||
count_is(max) {
|
||||
if max as uint < str::char_len(s) {
|
||||
str::unsafe::slice_bytes(s, 0u, max as uint)
|
||||
str::substr(s, 0u, max as uint)
|
||||
} else { s }
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user