File tree Expand file tree Collapse file tree 2 files changed +5
-7
lines changed
Expand file tree Collapse file tree 2 files changed +5
-7
lines changed Original file line number Diff line number Diff line change @@ -51,7 +51,7 @@ pub enum NpyIterFlag {
5151}
5252
5353impl NpyIterFlag {
54- fn to_c_enum ( & self ) -> npy_uint32 {
54+ fn to_c_enum ( self ) -> npy_uint32 {
5555 use NpyIterFlag :: * ;
5656 match self {
5757 CommonDtype => NPY_ITER_COMMON_DTYPE ,
Original file line number Diff line number Diff line change @@ -73,12 +73,10 @@ where
7373 DOUT : Dimension ,
7474 T : Element ,
7575{
76- let subscripts: std:: borrow:: Cow < CStr > = if subscripts. ends_with ( "\0 " ) {
77- CStr :: from_bytes_with_nul ( subscripts. as_bytes ( ) )
78- . unwrap ( )
79- . into ( )
80- } else {
81- std:: ffi:: CString :: new ( subscripts) . unwrap ( ) . into ( )
76+ let subscripts: std:: borrow:: Cow < CStr > = match CStr :: from_bytes_with_nul ( subscripts. as_bytes ( ) )
77+ {
78+ Ok ( subscripts) => subscripts. into ( ) ,
79+ Err ( _) => std:: ffi:: CString :: new ( subscripts) . unwrap ( ) . into ( ) ,
8280 } ;
8381 let obj = unsafe {
8482 let result = PY_ARRAY_API . PyArray_EinsteinSum (
You can’t perform that action at this time.
0 commit comments