Skip to content

Commit 1fd7bb5

Browse files
committed
no let-else
1 parent 8667203 commit 1fd7bb5

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/random.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -117,9 +117,12 @@ impl<'py> PyBitGeneratorMethods for Bound<'py, PyBitGenerator> {
117117

118118
assert_eq!(capsule.name()?, Some(ffi::c_str!("BitGenerator")));
119119
let ptr = capsule.pointer() as *mut bitgen_t;
120-
let Some(non_null) = NonNull::new(ptr) else {
121-
lock.call_method0(intern!(py, "release"))?;
122-
return Err(PyRuntimeError::new_err("Invalid BitGenerator capsule"));
120+
let non_null = match NonNull::new(ptr) {
121+
Some(non_null) => non_null,
122+
None => {
123+
lock.call_method0(intern!(py, "release"))?;
124+
return Err(PyRuntimeError::new_err("Invalid BitGenerator capsule"));
125+
}
123126
};
124127
Ok(PyBitGeneratorGuard {
125128
raw_bitgen: non_null,

0 commit comments

Comments
 (0)