@@ -581,7 +581,7 @@ mod array {
581581 . chars ( )
582582 . exactly_one ( )
583583 . map ( |ch| Self ( ch as _ ) )
584- . map_err ( |_| vm. new_type_error ( "array item must be unicode character" . into ( ) ) )
584+ . map_err ( |_| vm. new_type_error ( "array item must be unicode character" ) )
585585 }
586586 fn byteswap ( self ) -> Self {
587587 Self ( self . 0 . swap_bytes ( ) )
@@ -832,9 +832,9 @@ mod array {
832832 ) )
833833 } ) ?;
834834 if zelf. read ( ) . typecode ( ) != 'u' {
835- return Err ( vm . new_value_error (
836- "fromunicode() may only be called on unicode type arrays" . into ( ) ,
837- ) ) ;
835+ return Err (
836+ vm . new_value_error ( "fromunicode() may only be called on unicode type arrays" )
837+ ) ;
838838 }
839839 let mut w = zelf. try_resizable ( vm) ?;
840840 let bytes = Self :: _unicode_to_wchar_bytes ( wtf8, w. itemsize ( ) ) ;
@@ -846,9 +846,9 @@ mod array {
846846 fn tounicode ( & self , vm : & VirtualMachine ) -> PyResult < Wtf8Buf > {
847847 let array = self . array . read ( ) ;
848848 if array. typecode ( ) != 'u' {
849- return Err ( vm . new_value_error (
850- "tounicode() may only be called on unicode type arrays" . into ( ) ,
851- ) ) ;
849+ return Err (
850+ vm . new_value_error ( "tounicode() may only be called on unicode type arrays" )
851+ ) ;
852852 }
853853 let bytes = array. get_bytes ( ) ;
854854 Self :: _wchar_bytes_to_string ( bytes, self . itemsize ( ) , vm)
@@ -1500,7 +1500,7 @@ mod array {
15001500 . unwrap_or ( u8:: MAX )
15011501 . try_into ( )
15021502 . map_err ( |_| {
1503- vm. new_value_error ( "third argument must be a valid machine format code." . into ( ) )
1503+ vm. new_value_error ( "third argument must be a valid machine format code." )
15041504 } )
15051505 }
15061506 }
@@ -1572,11 +1572,11 @@ mod array {
15721572 fn check_type_code ( spec : PyStrRef , vm : & VirtualMachine ) -> PyResult < ArrayContentType > {
15731573 let spec = spec. as_str ( ) . chars ( ) . exactly_one ( ) . map_err ( |_| {
15741574 vm. new_type_error (
1575- "_array_reconstructor() argument 2 must be a unicode character, not str" . into ( ) ,
1575+ "_array_reconstructor() argument 2 must be a unicode character, not str" ,
15761576 )
15771577 } ) ?;
15781578 ArrayContentType :: from_char ( spec)
1579- . map_err ( |_| vm. new_value_error ( "second argument must be a valid type code" . into ( ) ) )
1579+ . map_err ( |_| vm. new_value_error ( "second argument must be a valid type code" ) )
15801580 }
15811581
15821582 macro_rules! chunk_to_obj {
@@ -1609,7 +1609,7 @@ mod array {
16091609 let format = args. mformat_code ;
16101610 let bytes = args. items . as_bytes ( ) ;
16111611 if bytes. len ( ) % format. item_size ( ) != 0 {
1612- return Err ( vm. new_value_error ( "bytes length not a multiple of item size" . into ( ) ) ) ;
1612+ return Err ( vm. new_value_error ( "bytes length not a multiple of item size" ) ) ;
16131613 }
16141614 if MachineFormatCode :: from_typecode ( array. typecode ( ) ) == Some ( format) {
16151615 array. frombytes ( bytes) ;
@@ -1642,9 +1642,8 @@ mod array {
16421642 } ) ?,
16431643 MachineFormatCode :: Utf16 { big_endian } => {
16441644 let utf16: Vec < _ > = chunks. map ( |b| chunk_to_obj ! ( b, u16 , big_endian) ) . collect ( ) ;
1645- let s = String :: from_utf16 ( & utf16) . map_err ( |_| {
1646- vm. new_unicode_encode_error ( "items cannot decode as utf16" . into ( ) )
1647- } ) ?;
1645+ let s = String :: from_utf16 ( & utf16)
1646+ . map_err ( |_| vm. new_unicode_encode_error ( "items cannot decode as utf16" ) ) ?;
16481647 let bytes = PyArray :: _unicode_to_wchar_bytes ( ( * s) . as_ref ( ) , array. itemsize ( ) ) ;
16491648 array. frombytes_move ( bytes) ;
16501649 }
0 commit comments