mirror of
https://github.com/launchbadge/sqlx.git
synced 2025-10-03 07:45:30 +00:00
Fix infinite compile loop regression from recursive Lazy reference
This commit is contained in:
parent
5d9c292132
commit
eda78a7258
@ -37,7 +37,7 @@ struct Metadata {
|
|||||||
static METADATA: Lazy<Metadata> = Lazy::new(|| {
|
static METADATA: Lazy<Metadata> = Lazy::new(|| {
|
||||||
use std::env;
|
use std::env;
|
||||||
|
|
||||||
let manifest_dir = env::var("CARGO_MANIFEST_DIR")
|
let manifest_dir: PathBuf = env::var("CARGO_MANIFEST_DIR")
|
||||||
.expect("`CARGO_MANIFEST_DIR` must be set")
|
.expect("`CARGO_MANIFEST_DIR` must be set")
|
||||||
.into();
|
.into();
|
||||||
|
|
||||||
@ -47,7 +47,7 @@ static METADATA: Lazy<Metadata> = Lazy::new(|| {
|
|||||||
|
|
||||||
// If a .env file exists at CARGO_MANIFEST_DIR, load environment variables from this,
|
// If a .env file exists at CARGO_MANIFEST_DIR, load environment variables from this,
|
||||||
// otherwise fallback to default dotenv behaviour.
|
// otherwise fallback to default dotenv behaviour.
|
||||||
let env_path = METADATA.manifest_dir.join(".env");
|
let env_path = manifest_dir.join(".env");
|
||||||
if env_path.exists() {
|
if env_path.exists() {
|
||||||
let res = dotenv::from_path(&env_path);
|
let res = dotenv::from_path(&env_path);
|
||||||
if let Err(e) = res {
|
if let Err(e) = res {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user