Skip to content

Commit 99e09b7

Browse files
committed
Make Clippy (mostly) happy.
1 parent cdb1ed9 commit 99e09b7

File tree

2 files changed

+5
-7
lines changed

2 files changed

+5
-7
lines changed

src/npyiter.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ pub enum NpyIterFlag {
5151
}
5252

5353
impl 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,

src/sum_products.rs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff 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(

0 commit comments

Comments
 (0)