Skip to content

Commit 32c54c9

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

File tree

3 files changed

+4
-8
lines changed

3 files changed

+4
-8
lines changed

Cargo.toml

+1-1
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

+3-3
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ use std::str;
2020
use std::sync::Mutex;
2121
use std::sync::Once;
2222

23+
#[cfg(not(target_os = "ios"))]
24+
use self::once_cell::Lazy;
2325
#[cfg(not(target_os = "ios"))]
2426
use self::security_framework::os::macos::certificate::{PropertyType, SecCertificateExt};
2527
#[cfg(not(target_os = "ios"))]
@@ -38,9 +40,7 @@ use {Protocol, TlsAcceptorBuilder, TlsConnectorBuilder};
3840
static SET_AT_EXIT: Once = Once::new();
3941

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

4545
fn convert_protocol(protocol: Protocol) -> SslProtocol {
4646
match protocol {

src/lib.rs

-4
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)