Skip to content

Commit

Permalink
refactor(rust): prefer once_cell over lazy_static:
Browse files Browse the repository at this point in the history
  • Loading branch information
choznerol committed Nov 9, 2021
1 parent 57d4524 commit 8d6abd3
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 18 deletions.
14 changes: 7 additions & 7 deletions platform/rust/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion platform/rust/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ include = ["src/lib.rs", "Cargo.toml"]

[dependencies]
fast_chemail = "0.9.5"
lazy_static = "1.4.0"
once_cell = "1.8.0"

[dev-dependencies]
pretty_assertions = "0.1.2"
Expand Down
8 changes: 3 additions & 5 deletions platform/rust/src/lib.rs

Large diffs are not rendered by default.

8 changes: 3 additions & 5 deletions platform/rust/src/lib.tmpl.rs
Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@
#[cfg(test)]
extern crate pretty_assertions;
extern crate lazy_static;
extern crate once_cell;
extern crate fast_chemail;

use lazy_static::lazy_static;
use once_cell::sync::Lazy;
use std::collections::HashSet;
use std::sync::RwLock;

static BLACKLIST: &'static [&'static str] = &[{{ &listSTR }}];

lazy_static! {
static ref CUSTOM_DOMAINS: RwLock<HashSet<&'static str>> = RwLock::new(HashSet::new());
}
static CUSTOM_DOMAINS: Lazy<RwLock<HashSet<&'static str>>> = Lazy::new(|| RwLock::new(HashSet::new()));

/// # Usage
///
Expand Down

0 comments on commit 8d6abd3

Please sign in to comment.