fix clippy
This commit is contained in:
1 parent
5f8d0f6c40
commit
649d264a38
3 files changed
+44
-45
No files matched your search
+33
-42
@@ -1,51 +1,42 @@
|
|||||||
fn main() {
|
fn main() {
|
||||||
// Warn the user if they enabled the launch feature without any renderers
|
// Warn the user if they enabled the launch feature without any renderers
|
||||||
if feature_enabled("launch") {
|
if feature_enabled("launch") {
|
||||||
if feature_enabled("third-party-renderer"){
|
if feature_enabled("third-party-renderer") {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
let liveview_renderers = [
|
let liveview_renderers = ["liveview", "axum", "salvo", "warp", "rocket"];
|
||||||
"liveview",
|
let fullstack_renderers = ["axum", "salvo", "warp"];
|
||||||
"axum",
|
let client_renderers = ["desktop", "mobile", "web", "tui"];
|
||||||
"salvo",
|
let client_renderer_selected = client_renderers
|
||||||
"warp",
|
.iter()
|
||||||
"rocket",
|
.any(|renderer| feature_enabled(renderer));
|
||||||
];
|
if feature_enabled("fullstack") {
|
||||||
let fullstack_renderers = [
|
let server_fullstack_enabled = fullstack_renderers
|
||||||
"axum",
|
.iter()
|
||||||
"salvo",
|
.any(|renderer| feature_enabled(renderer));
|
||||||
"warp",
|
if !server_fullstack_enabled && !client_renderer_selected {
|
||||||
];
|
println!("cargo:warning=You have enabled the launch and fullstack features, but have not enabled any renderers. The application will not be able to launch. Try enabling one of the following renderers: {} for the server or one of the following renderers: {} for the client.", fullstack_renderers.join(", "), client_renderers.join(", "));
|
||||||
let client_renderers = [
|
}
|
||||||
"desktop",
|
}
|
||||||
"mobile",
|
|
||||||
"web",
|
|
||||||
"tui",
|
|
||||||
];
|
|
||||||
let client_renderer_selected = client_renderers.iter().any(|renderer| feature_enabled(renderer));
|
|
||||||
if feature_enabled("fullstack") {
|
|
||||||
let server_fullstack_enabled = fullstack_renderers.iter().any(|renderer| feature_enabled(renderer));
|
|
||||||
if !server_fullstack_enabled && !client_renderer_selected {
|
|
||||||
println!("cargo:warning=You have enabled the launch and fullstack features, but have not enabled any renderers. The application will not be able to launch. Try enabling one of the following renderers: {} for the server or one of the following renderers: {} for the client.", fullstack_renderers.join(", "), client_renderers.join(", "));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if feature_enabled("liveview") {
|
if feature_enabled("liveview") {
|
||||||
let server_selected = liveview_renderers.iter().any(|renderer| feature_enabled(renderer));
|
let server_selected = liveview_renderers
|
||||||
if !server_selected {
|
.iter()
|
||||||
println!("cargo:warning=You have enabled the launch and liveview features, but have not enabled any liveview renderers. The application will not be able to launch. Try enabling one of the following renderers: {}", liveview_renderers.join(", "));
|
.any(|renderer| feature_enabled(renderer));
|
||||||
}
|
if !server_selected {
|
||||||
}
|
println!("cargo:warning=You have enabled the launch and liveview features, but have not enabled any liveview renderers. The application will not be able to launch. Try enabling one of the following renderers: {}", liveview_renderers.join(", "));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if !client_renderer_selected {
|
if !client_renderer_selected {
|
||||||
println!("cargo:warning=You have enabled the launch feature, but have not enabled any client renderers. The application will not be able to launch. Try enabling one of the following renderers: {}, fullstack or liveview", client_renderers.join(", "));
|
println!("cargo:warning=You have enabled the launch feature, but have not enabled any client renderers. The application will not be able to launch. Try enabling one of the following renderers: {}, fullstack or liveview", client_renderers.join(", "));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn feature_enabled(feature: &str) -> bool {
|
fn feature_enabled(feature: &str) -> bool {
|
||||||
let feature = "CARGO_FEATURE_".to_owned() + &feature.to_uppercase().replace("-", "_");
|
let feature = "CARGO_FEATURE_".to_owned() + &feature.to_uppercase().replace('-', "_");
|
||||||
println!("cargo:rerun-if-env-changed={}", feature);
|
println!("cargo:rerun-if-env-changed={}", feature);
|
||||||
std::env::var(feature).is_ok()
|
std::env::var(feature).is_ok()
|
||||||
}
|
}
|
||||||
@@ -167,12 +167,20 @@ mod current_platform {
|
|||||||
#[cfg(feature = "fullstack")]
|
#[cfg(feature = "fullstack")]
|
||||||
pub use dioxus_fullstack::launch::*;
|
pub use dioxus_fullstack::launch::*;
|
||||||
|
|
||||||
#[cfg(all(feature = "web", not(any(feature = "desktop", feature = "mobile", feature = "fullstack"))))]
|
#[cfg(all(
|
||||||
|
feature = "web",
|
||||||
|
not(any(feature = "desktop", feature = "mobile", feature = "fullstack"))
|
||||||
|
))]
|
||||||
pub use dioxus_web::launch::*;
|
pub use dioxus_web::launch::*;
|
||||||
|
|
||||||
#[cfg(all(
|
#[cfg(all(
|
||||||
feature = "liveview",
|
feature = "liveview",
|
||||||
not(any(feature = "web", feature = "desktop", feature = "mobile", feature = "fullstack"))
|
not(any(
|
||||||
|
feature = "web",
|
||||||
|
feature = "desktop",
|
||||||
|
feature = "mobile",
|
||||||
|
feature = "fullstack"
|
||||||
|
))
|
||||||
))]
|
))]
|
||||||
pub use dioxus_liveview::launch::*;
|
pub use dioxus_liveview::launch::*;
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ license = "MIT OR Apache-2.0"
|
|||||||
repository = "https://github.com/DioxusLabs/dioxus/"
|
repository = "https://github.com/DioxusLabs/dioxus/"
|
||||||
homepage = "https://dioxuslabs.com"
|
homepage = "https://dioxuslabs.com"
|
||||||
keywords = ["dom", "ui", "gui", "react", "wasm"]
|
keywords = ["dom", "ui", "gui", "react", "wasm"]
|
||||||
rust-version = "1.60.0"
|
rust-version = "1.64.0"
|
||||||
|
|
||||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user