Skip to content

Commit 3d448bd

Browse files
CAD97dtolnay
andcommitted
style nits
Co-authored-by: David Tolnay <[email protected]>
1 parent 8047f8f commit 3d448bd

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

library/alloc/src/string.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -741,7 +741,7 @@ impl String {
741741
return Err(FromUtf16Error(()));
742742
}
743743
match (cfg!(target_endian = "little"), unsafe { v.align_to::<u16>() }) {
744-
(true, (&[], v, &[])) => Self::from_utf16(v),
744+
(true, ([], v, [])) => Self::from_utf16(v),
745745
_ => decode_utf16(v.array_chunks::<2>().copied().map(u16::from_le_bytes))
746746
.collect::<Result<_, _>>()
747747
.map_err(|_| FromUtf16Error(())),
@@ -777,8 +777,8 @@ impl String {
777777
#[unstable(feature = "str_from_utf16_endian", issue = "none", reason = "recently added")]
778778
pub fn from_utf16le_lossy(v: &[u8]) -> String {
779779
match (cfg!(target_endian = "little"), unsafe { v.align_to::<u16>() }) {
780-
(true, (&[], v, &[])) => Self::from_utf16_lossy(v),
781-
(true, (&[], v, &[_remainder])) => Self::from_utf16_lossy(v) + "\u{FFFD}",
780+
(true, ([], v, [])) => Self::from_utf16_lossy(v),
781+
(true, ([], v, [_remainder])) => Self::from_utf16_lossy(v) + "\u{FFFD}",
782782
_ => {
783783
let mut iter = v.array_chunks::<2>();
784784
let string = decode_utf16(iter.by_ref().copied().map(u16::from_le_bytes))
@@ -816,7 +816,7 @@ impl String {
816816
return Err(FromUtf16Error(()));
817817
}
818818
match (cfg!(target_endian = "big"), unsafe { v.align_to::<u16>() }) {
819-
(true, (&[], v, &[])) => Self::from_utf16(v),
819+
(true, ([], v, [])) => Self::from_utf16(v),
820820
_ => decode_utf16(v.array_chunks::<2>().copied().map(u16::from_be_bytes))
821821
.collect::<Result<_, _>>()
822822
.map_err(|_| FromUtf16Error(())),
@@ -852,8 +852,8 @@ impl String {
852852
#[unstable(feature = "str_from_utf16_endian", issue = "none", reason = "recently added")]
853853
pub fn from_utf16be_lossy(v: &[u8]) -> String {
854854
match (cfg!(target_endian = "big"), unsafe { v.align_to::<u16>() }) {
855-
(true, (&[], v, &[])) => Self::from_utf16_lossy(v),
856-
(true, (&[], v, &[_remainder])) => Self::from_utf16_lossy(v) + "\u{FFFD}",
855+
(true, ([], v, [])) => Self::from_utf16_lossy(v),
856+
(true, ([], v, [_remainder])) => Self::from_utf16_lossy(v) + "\u{FFFD}",
857857
_ => {
858858
let mut iter = v.array_chunks::<2>();
859859
let string = decode_utf16(iter.by_ref().copied().map(u16::from_be_bytes))

0 commit comments

Comments
 (0)