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:
parent
85731dfe8e
commit
ff7017c308
36 changed files with 160 additions and 195 deletions
|
@ -14,7 +14,6 @@ proc-macro = true
|
|||
doctest = false
|
||||
|
||||
[dependencies]
|
||||
lazy_static.workspace = true
|
||||
sqlez.workspace = true
|
||||
sqlformat = "0.2"
|
||||
syn = "1.0"
|
||||
|
|
|
@ -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 {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue