Skip to content

Commit d51b2c0

Browse files
committed
Use Once::new instead of ONCE_INIT
1 parent e3fc96f commit d51b2c0

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/npyffi/array.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use pyo3::ffi::{self, PyObject, PyTypeObject};
44
use std::ops::Deref;
55
use std::os::raw::*;
66
use std::ptr;
7-
use std::sync::{Once, ONCE_INIT};
7+
use std::sync::Once;
88

99
use npyffi::*;
1010

@@ -42,7 +42,7 @@ pub struct PyArrayAPI {
4242
impl Deref for PyArrayAPI {
4343
type Target = PyArrayAPI_Inner;
4444
fn deref(&self) -> &Self::Target {
45-
static INIT_API: Once = ONCE_INIT;
45+
static INIT_API: Once = Once::new();
4646
static mut ARRAY_API_CACHE: PyArrayAPI_Inner = PyArrayAPI_Inner(ptr::null());
4747
unsafe {
4848
if ARRAY_API_CACHE.0.is_null() {

src/npyffi/ufunc.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
use std::ops::Deref;
44
use std::os::raw::*;
55
use std::ptr;
6-
use std::sync::{Once, ONCE_INIT};
6+
use std::sync::Once;
77

88
use pyo3::ffi::PyObject;
99

@@ -25,7 +25,7 @@ pub struct PyUFuncAPI {
2525
impl Deref for PyUFuncAPI {
2626
type Target = PyUFuncAPI_Inner;
2727
fn deref(&self) -> &Self::Target {
28-
static INIT_API: Once = ONCE_INIT;
28+
static INIT_API: Once = Once::new();
2929
static mut UFUNC_API_CACHE: PyUFuncAPI_Inner = PyUFuncAPI_Inner(ptr::null());
3030
unsafe {
3131
if UFUNC_API_CACHE.0.is_null() {

0 commit comments

Comments
 (0)