diff options
| author | Christopher Durham <cad97@cad97.com> | 2023-09-29 00:04:57 -0400 |
|---|---|---|
| committer | Christopher Durham <cad97@cad97.com> | 2023-09-29 00:04:57 -0400 |
| commit | 5facc32e22e8843a8c276305fff4ec84d718e1c0 (patch) | |
| tree | 5d970921a505d6c90b203b02c74a44329492f30d | |
| parent | 1efea3138554e37874c098e497f59e8f955d2d3a (diff) | |
| download | rust-5facc32e22e8843a8c276305fff4ec84d718e1c0.tar.gz rust-5facc32e22e8843a8c276305fff4ec84d718e1c0.zip | |
fix char imports
| -rw-r--r-- | library/alloc/src/string.rs | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/library/alloc/src/string.rs b/library/alloc/src/string.rs index 4e4c358200e..844441ba3a7 100644 --- a/library/alloc/src/string.rs +++ b/library/alloc/src/string.rs @@ -742,7 +742,7 @@ impl String { } match (cfg!(target_endian = "little"), unsafe { v.align_to::<u16>() }) { (true, ([], v, [])) => Self::from_utf16(v), - _ => decode_utf16(v.array_chunks::<2>().copied().map(u16::from_le_bytes)) + _ => char::decode_utf16(v.array_chunks::<2>().copied().map(u16::from_le_bytes)) .collect::<Result<_, _>>() .map_err(|_| FromUtf16Error(())), } @@ -781,8 +781,8 @@ impl String { (true, ([], v, [_remainder])) => Self::from_utf16_lossy(v) + "\u{FFFD}", _ => { let mut iter = v.array_chunks::<2>(); - let string = decode_utf16(iter.by_ref().copied().map(u16::from_le_bytes)) - .map(|r| r.unwrap_or(REPLACEMENT_CHARACTER)) + let string = char::decode_utf16(iter.by_ref().copied().map(u16::from_le_bytes)) + .map(|r| r.unwrap_or(char::REPLACEMENT_CHARACTER)) .collect(); if iter.remainder().is_empty() { string } else { string + "\u{FFFD}" } } @@ -817,7 +817,7 @@ impl String { } match (cfg!(target_endian = "big"), unsafe { v.align_to::<u16>() }) { (true, ([], v, [])) => Self::from_utf16(v), - _ => decode_utf16(v.array_chunks::<2>().copied().map(u16::from_be_bytes)) + _ => char::decode_utf16(v.array_chunks::<2>().copied().map(u16::from_be_bytes)) .collect::<Result<_, _>>() .map_err(|_| FromUtf16Error(())), } @@ -856,8 +856,8 @@ impl String { (true, ([], v, [_remainder])) => Self::from_utf16_lossy(v) + "\u{FFFD}", _ => { let mut iter = v.array_chunks::<2>(); - let string = decode_utf16(iter.by_ref().copied().map(u16::from_be_bytes)) - .map(|r| r.unwrap_or(REPLACEMENT_CHARACTER)) + let string = char::decode_utf16(iter.by_ref().copied().map(u16::from_be_bytes)) + .map(|r| r.unwrap_or(char::REPLACEMENT_CHARACTER)) .collect(); if iter.remainder().is_empty() { string } else { string + "\u{FFFD}" } } |
