Skip to content

Commit

Permalink
Replace lazy_static with once_cell
Browse files Browse the repository at this point in the history
  • Loading branch information
daxpedda committed Jun 24, 2023
1 parent 8fa929d commit dad5d5c
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 8 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ alpn = ["security-framework/alpn"]
[target.'cfg(any(target_os = "macos", target_os = "ios"))'.dependencies]
security-framework = "2.0.0"
security-framework-sys = "2.0.0"
lazy_static = "1.4.0"
once_cell = "1.0.0"
libc = "0.2"
tempfile = "3.1.0"

Expand Down
7 changes: 4 additions & 3 deletions src/imp/security_framework.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
extern crate libc;
extern crate once_cell;
extern crate security_framework;
extern crate security_framework_sys;
extern crate tempfile;
Expand All @@ -20,6 +21,8 @@ use std::str;
use std::sync::Mutex;
use std::sync::Once;

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

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

fn convert_protocol(protocol: Protocol) -> SslProtocol {
match protocol {
Expand Down
4 changes: 0 additions & 4 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,10 +98,6 @@
#![warn(missing_docs)]
#![cfg_attr(docsrs, feature(doc_cfg))]

#[macro_use]
#[cfg(any(target_os = "macos", target_os = "ios"))]
extern crate lazy_static;

use std::any::Any;
use std::error;
use std::fmt;
Expand Down

0 comments on commit dad5d5c

Please sign in to comment.