chore: Use `once_cell` instead of `lazy_static` (#178)

This commit is contained in:
Dmitry Dygalo 2022-09-13 16:06:21 +02:00 committed by GitHub
parent 5f77b420cd
commit 08152787e1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 7 deletions

1
Cargo.lock generated
View File

@ -1759,7 +1759,6 @@ dependencies = [
"filetime", "filetime",
"glob", "glob",
"itertools", "itertools",
"lazy_static",
"log", "log",
"notify", "notify",
"once_cell", "once_cell",

View File

@ -20,7 +20,6 @@ fern = { version = "0.6.1" }
filetime = { version = "0.2.17" } filetime = { version = "0.2.17" }
glob = { version = "0.3.0" } glob = { version = "0.3.0" }
itertools = "0.10.3" itertools = "0.10.3"
lazy_static = "1.4.0"
log = { version = "0.4.17" } log = { version = "0.4.17" }
notify = { version = "4.0.17" } notify = { version = "4.0.17" }
once_cell = { version = "1.13.1" } once_cell = { version = "1.13.1" }

View File

@ -1,8 +1,8 @@
use lazy_static::lazy_static; use once_cell::sync::Lazy;
use std::collections::BTreeSet; use std::collections::BTreeSet;
lazy_static! { static ANNOTATED_SUBSCRIPTS: Lazy<BTreeSet<&'static str>> = Lazy::new(|| {
static ref ANNOTATED_SUBSCRIPTS: BTreeSet<&'static str> = BTreeSet::from([ BTreeSet::from([
"AbstractAsyncContextManager", "AbstractAsyncContextManager",
"AbstractContextManager", "AbstractContextManager",
"AbstractSet", "AbstractSet",
@ -80,8 +80,8 @@ lazy_static! {
"set", "set",
"tuple", "tuple",
"type", "type",
]); ])
} });
pub fn is_annotated_subscript(name: &str) -> bool { pub fn is_annotated_subscript(name: &str) -> bool {
ANNOTATED_SUBSCRIPTS.contains(name) ANNOTATED_SUBSCRIPTS.contains(name)