Replace lazy_static with std::sync::LazyLock (#16066)

Closes #15860 

Since rust std now supports LazyLock replacing lazy_static with it
reduce the external dependency.

Release Notes:

- N/A

---------

Co-authored-by: Marshall Bowers <elliott.codes@gmail.com>
This commit is contained in:
Sinan Gençoğlu 2024-08-20 20:27:33 +02:00 committed by GitHub
parent 85731dfe8e
commit ff7017c308
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
36 changed files with 160 additions and 195 deletions

View file

@ -14,7 +14,6 @@ proc-macro = true
doctest = false
[dependencies]
lazy_static.workspace = true
sqlez.workspace = true
sqlformat = "0.2"
syn = "1.0"

View file

@ -1,12 +1,16 @@
use proc_macro::{Delimiter, Span, TokenStream, TokenTree};
use sqlez::thread_safe_connection::{locking_queue, ThreadSafeConnection};
use syn::Error;
lazy_static::lazy_static! {
static ref SQLITE: ThreadSafeConnection = {
ThreadSafeConnection::new(":memory:", false, None, Some(locking_queue()))
};
}
#[cfg(not(target_os = "linux"))]
static SQLITE: std::sync::LazyLock<sqlez::thread_safe_connection::ThreadSafeConnection> =
std::sync::LazyLock::new(|| {
sqlez::thread_safe_connection::ThreadSafeConnection::new(
":memory:",
false,
None,
Some(sqlez::thread_safe_connection::locking_queue()),
)
});
#[proc_macro]
pub fn sql(tokens: TokenStream) -> TokenStream {