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 {
51
51
}
52
52
53
53
impl NpyIterFlag {
54
- fn to_c_enum ( & self ) -> npy_uint32 {
54
+ fn to_c_enum ( self ) -> npy_uint32 {
55
55
use NpyIterFlag :: * ;
56
56
match self {
57
57
CommonDtype => NPY_ITER_COMMON_DTYPE ,
Original file line number Diff line number Diff line change @@ -73,12 +73,10 @@ where
73
73
DOUT : Dimension ,
74
74
T : Element ,
75
75
{
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 ( ) ,
82
80
} ;
83
81
let obj = unsafe {
84
82
let result = PY_ARRAY_API . PyArray_EinsteinSum (
You can’t perform that action at this time.
0 commit comments