From 8fdd1b4d3bd2b055250c3ff70b1e569ef93cd9d5 Mon Sep 17 00:00:00 2001 From: Marc Espin Date: Tue, 10 Dec 2024 11:05:15 +0100 Subject: [PATCH 1/2] feat: Reexport the `Warning` trait in dioxus-signals to allow the use of `::allow()` without pulling the warnings crate --- packages/signals/src/warnings.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/signals/src/warnings.rs b/packages/signals/src/warnings.rs index 60d51993a5..809d792b53 100644 --- a/packages/signals/src/warnings.rs +++ b/packages/signals/src/warnings.rs @@ -1,6 +1,7 @@ //! Warnings that can be triggered by suspicious usage of signals use warnings::warning; +pub use warnings::Warning; /// A warning that is triggered when a copy value is used in a higher scope that it is owned by #[warning] From 98ff41a2e5abe7663f3c3dd8f919b36ff5f75358 Mon Sep 17 00:00:00 2001 From: Jonathan Kelley Date: Tue, 7 Jan 2025 13:55:39 -0800 Subject: [PATCH 2/2] re-export warnings under dioxus::warnings --- Cargo.lock | 2 ++ packages/dioxus-lib/Cargo.toml | 4 +++- packages/dioxus-lib/src/lib.rs | 3 +++ packages/dioxus/Cargo.toml | 7 +++++-- packages/dioxus/src/lib.rs | 4 ++++ packages/signals/src/warnings.rs | 1 - 6 files changed, 17 insertions(+), 4 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index fb0955122e..1e32fcc827 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3404,6 +3404,7 @@ dependencies = [ "thiserror 1.0.69", "tokio", "tracing", + "warnings", ] [[package]] @@ -3963,6 +3964,7 @@ dependencies = [ "dioxus-html", "dioxus-rsx", "dioxus-signals", + "warnings", ] [[package]] diff --git a/packages/dioxus-lib/Cargo.toml b/packages/dioxus-lib/Cargo.toml index 7f80a27f51..1417836ee6 100644 --- a/packages/dioxus-lib/Cargo.toml +++ b/packages/dioxus-lib/Cargo.toml @@ -20,16 +20,18 @@ dioxus-config-macro = { workspace = true, optional = true } dioxus-hooks = { workspace = true, optional = true } dioxus-rsx = { workspace = true, optional = true } dioxus-signals = { workspace = true, optional = true } +warnings = { workspace = true, optional = true } [dev-dependencies] dioxus = { workspace = true } [features] -default = ["macro", "html", "signals", "hooks"] +default = ["macro", "html", "signals", "hooks", "warnings"] signals = ["dep:dioxus-signals"] macro = ["dep:dioxus-core-macro", "dep:dioxus-rsx", "dep:dioxus-config-macro"] html = ["dep:dioxus-html", "dep:dioxus-document", "dep:dioxus-history"] hooks = ["dep:dioxus-hooks"] +warnings = ["dep:warnings"] [package.metadata.docs.rs] cargo-args = ["-Zunstable-options", "-Zrustdoc-scrape-examples"] diff --git a/packages/dioxus-lib/src/lib.rs b/packages/dioxus-lib/src/lib.rs index 0e5cdc9224..0c8aaf80ff 100644 --- a/packages/dioxus-lib/src/lib.rs +++ b/packages/dioxus-lib/src/lib.rs @@ -28,6 +28,9 @@ pub use dioxus_rsx as rsx; #[cfg(feature = "macro")] pub use dioxus_core_macro as core_macro; +#[cfg(feature = "warnings")] +pub use warnings; + pub mod prelude { #[cfg(feature = "html")] #[cfg_attr(docsrs, doc(cfg(feature = "html")))] diff --git a/packages/dioxus/Cargo.toml b/packages/dioxus/Cargo.toml index fb4497d049..f88f525046 100644 --- a/packages/dioxus/Cargo.toml +++ b/packages/dioxus/Cargo.toml @@ -28,6 +28,7 @@ dioxus-liveview = { workspace = true, optional = true } dioxus-ssr = { workspace = true, optional = true } manganis = { workspace = true, features = ["dioxus"], optional = true } dioxus-logger = { workspace = true, optional = true } +warnings = { workspace = true, optional = true } serde = { workspace = true, optional = true } dioxus-cli-config = { workspace = true, optional = true } @@ -36,7 +37,7 @@ dioxus-cli-config = { workspace = true, optional = true } dioxus-devtools = { workspace = true, optional = true } [features] -default = ["macro", "html", "signals", "hooks", "launch", "mounted", "file_engine", "document", "asset", "devtools", "logger"] +default = ["macro", "html", "signals", "hooks", "launch", "mounted", "file_engine", "document", "asset", "devtools", "logger", "warnings"] minimal = ["macro", "html", "signals", "hooks", "launch"] signals = ["dep:dioxus-signals"] macro = ["dep:dioxus-core-macro"] @@ -48,6 +49,7 @@ file_engine = ["dioxus-web?/file_engine"] asset = ["dep:manganis"] document = ["dioxus-web?/document", "dep:dioxus-document", "dep:dioxus-history"] logger = ["dep:dioxus-logger"] +warnings = ["dep:warnings"] launch = ["dep:dioxus-config-macro"] router = ["dep:dioxus-router"] @@ -89,7 +91,8 @@ features = [ "hooks", "html", "liveview", - "server" + "server", + "warnings" ] targets = [ "wasm32-unknown-unknown", diff --git a/packages/dioxus/src/lib.rs b/packages/dioxus/src/lib.rs index 3e4063ae02..320d5ca4cf 100644 --- a/packages/dioxus/src/lib.rs +++ b/packages/dioxus/src/lib.rs @@ -163,3 +163,7 @@ pub use dioxus_liveview as liveview; #[cfg(feature = "ssr")] #[cfg_attr(docsrs, doc(cfg(feature = "ssr")))] pub use dioxus_ssr as ssr; + +#[cfg(feature = "warnings")] +#[cfg_attr(docsrs, doc(cfg(feature = "warnings")))] +pub use warnings; diff --git a/packages/signals/src/warnings.rs b/packages/signals/src/warnings.rs index 809d792b53..60d51993a5 100644 --- a/packages/signals/src/warnings.rs +++ b/packages/signals/src/warnings.rs @@ -1,7 +1,6 @@ //! Warnings that can be triggered by suspicious usage of signals use warnings::warning; -pub use warnings::Warning; /// A warning that is triggered when a copy value is used in a higher scope that it is owned by #[warning]