Skip to content

Commit dad5d5c

Browse files
committed
Replace lazy_static with once_cell
1 parent 8fa929d commit dad5d5c

File tree

3 files changed

+5
-8
lines changed

3 files changed

+5
-8
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ alpn = ["security-framework/alpn"]
1919
[target.'cfg(any(target_os = "macos", target_os = "ios"))'.dependencies]
2020
security-framework = "2.0.0"
2121
security-framework-sys = "2.0.0"
22-
lazy_static = "1.4.0"
22+
once_cell = "1.0.0"
2323
libc = "0.2"
2424
tempfile = "3.1.0"
2525

src/imp/security_framework.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
extern crate libc;
2+
extern crate once_cell;
23
extern crate security_framework;
34
extern crate security_framework_sys;
45
extern crate tempfile;
@@ -20,6 +21,8 @@ use std::str;
2021
use std::sync::Mutex;
2122
use std::sync::Once;
2223

24+
#[cfg(not(target_os = "ios"))]
25+
use self::once_cell::Lazy;
2326
#[cfg(not(target_os = "ios"))]
2427
use self::security_framework::os::macos::certificate::{PropertyType, SecCertificateExt};
2528
#[cfg(not(target_os = "ios"))]
@@ -38,9 +41,7 @@ use {Protocol, TlsAcceptorBuilder, TlsConnectorBuilder};
3841
static SET_AT_EXIT: Once = Once::new();
3942

4043
#[cfg(not(target_os = "ios"))]
41-
lazy_static! {
42-
static ref TEMP_KEYCHAIN: Mutex<Option<(SecKeychain, TempDir)>> = Mutex::new(None);
43-
}
44+
static TEMP_KEYCHAIN: Lazy<Mutex<Option<(SecKeychain, TempDir)>>> = Lazy::new(|| Mutex::new(None));
4445

4546
fn convert_protocol(protocol: Protocol) -> SslProtocol {
4647
match protocol {

src/lib.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -98,10 +98,6 @@
9898
#![warn(missing_docs)]
9999
#![cfg_attr(docsrs, feature(doc_cfg))]
100100

101-
#[macro_use]
102-
#[cfg(any(target_os = "macos", target_os = "ios"))]
103-
extern crate lazy_static;
104-
105101
use std::any::Any;
106102
use std::error;
107103
use std::fmt;

0 commit comments

Comments
 (0)