From 08152787e1e7a2d96bc930143c4cdc7f7a8835aa Mon Sep 17 00:00:00 2001 From: Dmitry Dygalo Date: Tue, 13 Sep 2022 16:06:21 +0200 Subject: [PATCH] chore: Use `once_cell` instead of `lazy_static` (#178) --- Cargo.lock | 1 - Cargo.toml | 1 - src/python/typing.rs | 10 +++++----- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 4dbbcce119..05fedf6504 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1759,7 +1759,6 @@ dependencies = [ "filetime", "glob", "itertools", - "lazy_static", "log", "notify", "once_cell", diff --git a/Cargo.toml b/Cargo.toml index 7e71e9b48e..cfe433c409 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -20,7 +20,6 @@ fern = { version = "0.6.1" } filetime = { version = "0.2.17" } glob = { version = "0.3.0" } itertools = "0.10.3" -lazy_static = "1.4.0" log = { version = "0.4.17" } notify = { version = "4.0.17" } once_cell = { version = "1.13.1" } diff --git a/src/python/typing.rs b/src/python/typing.rs index dcf7c4f548..82fb93e1d5 100644 --- a/src/python/typing.rs +++ b/src/python/typing.rs @@ -1,8 +1,8 @@ -use lazy_static::lazy_static; +use once_cell::sync::Lazy; use std::collections::BTreeSet; -lazy_static! { - static ref ANNOTATED_SUBSCRIPTS: BTreeSet<&'static str> = BTreeSet::from([ +static ANNOTATED_SUBSCRIPTS: Lazy> = Lazy::new(|| { + BTreeSet::from([ "AbstractAsyncContextManager", "AbstractContextManager", "AbstractSet", @@ -80,8 +80,8 @@ lazy_static! { "set", "tuple", "type", - ]); -} + ]) +}); pub fn is_annotated_subscript(name: &str) -> bool { ANNOTATED_SUBSCRIPTS.contains(name)