mirror of
https://github.com/launchbadge/sqlx.git
synced 2025-12-29 21:00:54 +00:00
sqlx-macros: Replace lazy_static by once_cell
This commit is contained in:
parent
890f289f2f
commit
e8c367db6e
2
Cargo.lock
generated
2
Cargo.lock
generated
@ -2666,7 +2666,7 @@ dependencies = [
|
||||
"futures",
|
||||
"heck",
|
||||
"hex",
|
||||
"lazy_static",
|
||||
"once_cell",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"serde",
|
||||
|
||||
@ -59,7 +59,7 @@ futures = { version = "0.3.4", default-features = false, features = [ "executor"
|
||||
hex = { version = "0.4.2", optional = true }
|
||||
heck = "0.3.1"
|
||||
either = "1.5.3"
|
||||
lazy_static = "1.4.0"
|
||||
once_cell = "1.5.2"
|
||||
proc-macro2 = { version = "1.0.9", default-features = false }
|
||||
sqlx-core = { version = "0.4.2", default-features = false, path = "../sqlx-core" }
|
||||
sqlx-rt = { version = "0.2.0", default-features = false, path = "../sqlx-rt" }
|
||||
|
||||
@ -17,7 +17,7 @@ use crate::database::DatabaseExt;
|
||||
use crate::query::data::QueryData;
|
||||
use crate::query::input::RecordType;
|
||||
use either::Either;
|
||||
use lazy_static::lazy_static;
|
||||
use once_cell::sync::Lazy;
|
||||
|
||||
mod args;
|
||||
mod data;
|
||||
@ -26,19 +26,16 @@ mod output;
|
||||
|
||||
// If we are in a workspace, lookup `workspace_root` since `CARGO_MANIFEST_DIR` won't
|
||||
// reflect the workspace dir: https://github.com/rust-lang/cargo/issues/3946
|
||||
lazy_static! {
|
||||
static ref CRATE_ROOT: PathBuf = {
|
||||
let manifest_dir =
|
||||
env::var("CARGO_MANIFEST_DIR").expect("`CARGO_MANIFEST_DIR` must be set");
|
||||
static CRATE_ROOT: Lazy<PathBuf> = Lazy::new(|| {
|
||||
let manifest_dir = env::var("CARGO_MANIFEST_DIR").expect("`CARGO_MANIFEST_DIR` must be set");
|
||||
|
||||
let metadata = cargo_metadata::MetadataCommand::new()
|
||||
.current_dir(manifest_dir)
|
||||
.exec()
|
||||
.expect("Could not fetch metadata");
|
||||
let metadata = cargo_metadata::MetadataCommand::new()
|
||||
.current_dir(manifest_dir)
|
||||
.exec()
|
||||
.expect("Could not fetch metadata");
|
||||
|
||||
metadata.workspace_root
|
||||
};
|
||||
}
|
||||
metadata.workspace_root
|
||||
});
|
||||
|
||||
pub fn expand_input(input: QueryMacroInput) -> crate::Result<TokenStream> {
|
||||
let manifest_dir =
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user