Skip to content

Commit 880c598

Browse files
committed
Fix deprecation warning in tests
1 parent 3c43a39 commit 880c598

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/test_utils.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use std::ops::{Deref, DerefMut};
22
use std::os::raw::c_char;
3-
use std::sync::{Once, ONCE_INIT};
3+
use std::sync::Once;
44

55
use crate::declare::{ClassDecl, ProtocolDecl};
66
use crate::runtime::{Class, Object, Protocol, Sel, self};
@@ -55,7 +55,7 @@ unsafe impl Encode for CustomStruct {
5555
}
5656

5757
pub fn custom_class() -> &'static Class {
58-
static REGISTER_CUSTOM_CLASS: Once = ONCE_INIT;
58+
static REGISTER_CUSTOM_CLASS: Once = Once::new();
5959

6060
REGISTER_CUSTOM_CLASS.call_once(|| {
6161
// The runtime will call this method, so it has to be implemented
@@ -114,7 +114,7 @@ pub fn custom_class() -> &'static Class {
114114
}
115115

116116
pub fn custom_protocol() -> &'static Protocol {
117-
static REGISTER_CUSTOM_PROTOCOL: Once = ONCE_INIT;
117+
static REGISTER_CUSTOM_PROTOCOL: Once = Once::new();
118118

119119
REGISTER_CUSTOM_PROTOCOL.call_once(|| {
120120
let mut decl = ProtocolDecl::new("CustomProtocol").unwrap();
@@ -130,7 +130,7 @@ pub fn custom_protocol() -> &'static Protocol {
130130
}
131131

132132
pub fn custom_subprotocol() -> &'static Protocol {
133-
static REGISTER_CUSTOM_SUBPROTOCOL: Once = ONCE_INIT;
133+
static REGISTER_CUSTOM_SUBPROTOCOL: Once = Once::new();
134134

135135
REGISTER_CUSTOM_SUBPROTOCOL.call_once(|| {
136136
let super_proto = custom_protocol();
@@ -150,7 +150,7 @@ pub fn custom_object() -> CustomObject {
150150
}
151151

152152
pub fn custom_subclass() -> &'static Class {
153-
static REGISTER_CUSTOM_SUBCLASS: Once = ONCE_INIT;
153+
static REGISTER_CUSTOM_SUBCLASS: Once = Once::new();
154154

155155
REGISTER_CUSTOM_SUBCLASS.call_once(|| {
156156
let superclass = custom_class();

0 commit comments

Comments
 (0)