fix: rust-analyzer/cargo fmt issues with LEPTOS_OUTPUT_NAME

This commit is contained in:
Greg Johnston
2023-04-24 08:00:36 -04:00
parent 79c12c0129
commit 9723cc466e

View File

@@ -53,20 +53,23 @@ pub struct LeptosOptions {
impl LeptosOptions {
fn try_from_env() -> Result<Self, LeptosConfigError> {
let output_name = env_w_default(
"LEPTOS_OUTPUT_NAME",
std::option_env!("LEPTOS_OUTPUT_NAME",).unwrap_or_default(),
)?;
if output_name.is_empty() {
eprintln!(
"It looks like you're trying to compile Leptos without the \
LEPTOS_OUTPUT_NAME environment variable being set. There are \
two options\n 1. cargo-leptos is not being used, but \
get_configuration() is being passed None. This needs to be \
changed to Some(\"Cargo.toml\")\n 2. You are compiling \
Leptos without LEPTOS_OUTPUT_NAME being set with \
cargo-leptos. This shouldn't be possible!"
);
}
Ok(LeptosOptions {
output_name: env_w_default(
"LEPTOS_OUTPUT_NAME",
std::env!(
"LEPTOS_OUTPUT_NAME",
"It looks like you're trying to compile Leptos without \
the LEPTOS_OUTPUT_NAME environment variable being set. \
There are two options\n 1. cargo-leptos is not being \
used, but get_configuration() is being passed None. This \
needs to be changed to Some(\"Cargo.toml\")\n 2. You are \
compiling Leptos without LEPTOS_OUTPUT_NAME being set \
with cargo-leptos. This shouldn't be possible!"
),
)?,
output_name,
site_root: env_w_default("LEPTOS_SITE_ROOT", "target/site")?,
site_pkg_dir: env_w_default("LEPTOS_SITE_PKG_DIR", "pkg")?,
env: Env::default(),