@@ -741,7 +741,7 @@ impl String {
741
741
return Err ( FromUtf16Error ( ( ) ) ) ;
742
742
}
743
743
match ( cfg ! ( target_endian = "little" ) , unsafe { v. align_to :: < u16 > ( ) } ) {
744
- ( true , ( & [ ] , v, & [ ] ) ) => Self :: from_utf16 ( v) ,
744
+ ( true , ( [ ] , v, [ ] ) ) => Self :: from_utf16 ( v) ,
745
745
_ => decode_utf16 ( v. array_chunks :: < 2 > ( ) . copied ( ) . map ( u16:: from_le_bytes) )
746
746
. collect :: < Result < _ , _ > > ( )
747
747
. map_err ( |_| FromUtf16Error ( ( ) ) ) ,
@@ -777,8 +777,8 @@ impl String {
777
777
#[ unstable( feature = "str_from_utf16_endian" , issue = "none" , reason = "recently added" ) ]
778
778
pub fn from_utf16le_lossy ( v : & [ u8 ] ) -> String {
779
779
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} " ,
782
782
_ => {
783
783
let mut iter = v. array_chunks :: < 2 > ( ) ;
784
784
let string = decode_utf16 ( iter. by_ref ( ) . copied ( ) . map ( u16:: from_le_bytes) )
@@ -816,7 +816,7 @@ impl String {
816
816
return Err ( FromUtf16Error ( ( ) ) ) ;
817
817
}
818
818
match ( cfg ! ( target_endian = "big" ) , unsafe { v. align_to :: < u16 > ( ) } ) {
819
- ( true , ( & [ ] , v, & [ ] ) ) => Self :: from_utf16 ( v) ,
819
+ ( true , ( [ ] , v, [ ] ) ) => Self :: from_utf16 ( v) ,
820
820
_ => decode_utf16 ( v. array_chunks :: < 2 > ( ) . copied ( ) . map ( u16:: from_be_bytes) )
821
821
. collect :: < Result < _ , _ > > ( )
822
822
. map_err ( |_| FromUtf16Error ( ( ) ) ) ,
@@ -852,8 +852,8 @@ impl String {
852
852
#[ unstable( feature = "str_from_utf16_endian" , issue = "none" , reason = "recently added" ) ]
853
853
pub fn from_utf16be_lossy ( v : & [ u8 ] ) -> String {
854
854
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} " ,
857
857
_ => {
858
858
let mut iter = v. array_chunks :: < 2 > ( ) ;
859
859
let string = decode_utf16 ( iter. by_ref ( ) . copied ( ) . map ( u16:: from_be_bytes) )
0 commit comments