From 95da90f82e72b885ba8ff8381cc7b1e084c23e5c Mon Sep 17 00:00:00 2001 From: Lucas Fernandes Nogueira Date: Wed, 31 Jul 2024 07:14:05 -0300 Subject: [PATCH] fix: clippy warnings, add missing wry feature on examples (#1604) * fix: clippy warnings, add missing wry feature on examples * schema feat does not exist * also add compression --- examples/api/src-tauri/Cargo.toml | 8 ++++--- .../src-tauri/gen/schemas/desktop-schema.json | 14 +++++++++++++ .../examples/app/src-tauri/Cargo.toml | 2 +- plugins/notification/src/desktop.rs | 4 ++-- plugins/notification/src/models.rs | 2 ++ .../examples/vanilla/src-tauri/Cargo.toml | 2 +- .../AppSettingsManager/src-tauri/Cargo.toml | 2 +- plugins/updater/src/config.rs | 21 +++++++++---------- plugins/updater/tests/app-updater/Cargo.toml | 2 +- .../examples/tauri-app/src-tauri/Cargo.toml | 2 +- 10 files changed, 38 insertions(+), 21 deletions(-) diff --git a/examples/api/src-tauri/Cargo.toml b/examples/api/src-tauri/Cargo.toml index 22b58041..2805c6b7 100644 --- a/examples/api/src-tauri/Cargo.toml +++ b/examples/api/src-tauri/Cargo.toml @@ -29,9 +29,11 @@ tauri-plugin-os = { path = "../../../plugins/os", version = "2.0.0-beta.8" } tauri-plugin-process = { path = "../../../plugins/process", version = "2.0.0-beta.8" } tauri-plugin-shell = { path = "../../../plugins/shell", version = "2.0.0-beta.9" } - [dependencies.tauri] - workspace = true - features = [ +[dependencies.tauri] +workspace = true +features = [ + "wry", + "compression", "image-ico", "image-png", "isolation", diff --git a/examples/api/src-tauri/gen/schemas/desktop-schema.json b/examples/api/src-tauri/gen/schemas/desktop-schema.json index cfe666a1..086c1158 100644 --- a/examples/api/src-tauri/gen/schemas/desktop-schema.json +++ b/examples/api/src-tauri/gen/schemas/desktop-schema.json @@ -6754,6 +6754,13 @@ "window:allow-set-size" ] }, + { + "description": "window:allow-set-size-constraints -> Enables the set_size_constraints command without any pre-configured scope.", + "type": "string", + "enum": [ + "window:allow-set-size-constraints" + ] + }, { "description": "window:allow-set-skip-taskbar -> Enables the set_skip_taskbar command without any pre-configured scope.", "type": "string", @@ -7202,6 +7209,13 @@ "window:deny-set-size" ] }, + { + "description": "window:deny-set-size-constraints -> Denies the set_size_constraints command without any pre-configured scope.", + "type": "string", + "enum": [ + "window:deny-set-size-constraints" + ] + }, { "description": "window:deny-set-skip-taskbar -> Denies the set_skip_taskbar command without any pre-configured scope.", "type": "string", diff --git a/plugins/deep-link/examples/app/src-tauri/Cargo.toml b/plugins/deep-link/examples/app/src-tauri/Cargo.toml index 24e4d6ca..4b8e7a7d 100644 --- a/plugins/deep-link/examples/app/src-tauri/Cargo.toml +++ b/plugins/deep-link/examples/app/src-tauri/Cargo.toml @@ -19,7 +19,7 @@ tauri-build = { workspace = true } [dependencies] serde = { workspace = true } serde_json = { workspace = true } -tauri = { workspace = true } +tauri = { workspace = true, features = ["wry", "compression"] } tauri-plugin-deep-link = { path = "../../../" } [features] diff --git a/plugins/notification/src/desktop.rs b/plugins/notification/src/desktop.rs index cef60e22..05a72a47 100644 --- a/plugins/notification/src/desktop.rs +++ b/plugins/notification/src/desktop.rs @@ -156,7 +156,7 @@ mod imp { /// /// - **Windows**: Not supported on Windows 7. If your app targets it, enable the `windows7-compat` feature and use [`Self::notify`]. #[cfg_attr( - all(not(doc_cfg), feature = "windows7-compat"), + all(not(docsrs), feature = "windows7-compat"), deprecated = "This function does not work on Windows 7. Use `Self::notify` instead." )] pub fn show(self) -> crate::Result<()> { @@ -220,7 +220,7 @@ mod imp { /// .expect("error while running tauri application"); /// ``` #[cfg(feature = "windows7-compat")] - #[cfg_attr(doc_cfg, doc(cfg(feature = "windows7-compat")))] + #[cfg_attr(docsrs, doc(cfg(feature = "windows7-compat")))] #[allow(unused_variables)] pub fn notify(self, app: &tauri::AppHandle) -> crate::Result<()> { #[cfg(windows)] diff --git a/plugins/notification/src/models.rs b/plugins/notification/src/models.rs index aa290dd3..4c260597 100644 --- a/plugins/notification/src/models.rs +++ b/plugins/notification/src/models.rs @@ -352,6 +352,7 @@ impl ActiveNotification { } } +#[cfg(mobile)] #[derive(Debug, Serialize)] #[serde(rename_all = "camelCase")] pub struct ActionType { @@ -364,6 +365,7 @@ pub struct ActionType { hidden_previews_show_subtitle: bool, } +#[cfg(mobile)] #[derive(Debug, Serialize)] #[serde(rename_all = "camelCase")] pub struct Action { diff --git a/plugins/single-instance/examples/vanilla/src-tauri/Cargo.toml b/plugins/single-instance/examples/vanilla/src-tauri/Cargo.toml index 949a8e57..da5d8cd6 100644 --- a/plugins/single-instance/examples/vanilla/src-tauri/Cargo.toml +++ b/plugins/single-instance/examples/vanilla/src-tauri/Cargo.toml @@ -10,7 +10,7 @@ rust-version = "1.75" [dependencies] serde = { workspace = true } serde_json = { workspace = true } -tauri = { workspace = true } +tauri = { workspace = true, features = ["wry", "compression"] } tauri-plugin-single-instance = { path = "../../../" } tauri-plugin-cli = { path = "../../../../cli" } diff --git a/plugins/store/examples/AppSettingsManager/src-tauri/Cargo.toml b/plugins/store/examples/AppSettingsManager/src-tauri/Cargo.toml index c12fe7df..7c60d516 100644 --- a/plugins/store/examples/AppSettingsManager/src-tauri/Cargo.toml +++ b/plugins/store/examples/AppSettingsManager/src-tauri/Cargo.toml @@ -13,7 +13,7 @@ edition = "2021" tauri-build = { workspace = true } [dependencies] -tauri = { workspace = true } +tauri = { workspace = true, features = ["wry", "compression"] } serde = { workspace = true } serde_json = { workspace = true } tauri-plugin-store = { path = "../../../" } diff --git a/plugins/updater/src/config.rs b/plugins/updater/src/config.rs index ec683590..3c6f5d42 100644 --- a/plugins/updater/src/config.rs +++ b/plugins/updater/src/config.rs @@ -121,18 +121,17 @@ impl<'de> Deserialize<'de> for UpdaterEndpoint { D: Deserializer<'de>, { let url = Url::deserialize(deserializer)?; - #[cfg(not(feature = "schema"))] - { - if url.scheme() != "https" { - #[cfg(debug_assertions)] - eprintln!("[\x1b[33mWARNING\x1b[0m] The configured updater endpoint doesn't use `https` protocol. This is allowed in development but will fail in release builds."); - - #[cfg(not(debug_assertions))] - return Err(serde::de::Error::custom( - "The configured updater endpoint must use the `https` protocol.", - )); - } + + if url.scheme() != "https" { + #[cfg(debug_assertions)] + eprintln!("[\x1b[33mWARNING\x1b[0m] The configured updater endpoint doesn't use `https` protocol. This is allowed in development but will fail in release builds."); + + #[cfg(not(debug_assertions))] + return Err(serde::de::Error::custom( + "The configured updater endpoint must use the `https` protocol.", + )); } + Ok(Self(url)) } } diff --git a/plugins/updater/tests/app-updater/Cargo.toml b/plugins/updater/tests/app-updater/Cargo.toml index b0364407..71b9f900 100644 --- a/plugins/updater/tests/app-updater/Cargo.toml +++ b/plugins/updater/tests/app-updater/Cargo.toml @@ -7,7 +7,7 @@ edition = { workspace = true } tauri-build = { workspace = true } [dependencies] -tauri = { workspace = true } +tauri = { workspace = true, features = ["wry", "compression"] } serde = { workspace = true } serde_json = { workspace = true } tauri-plugin-updater = { path = "../.." } diff --git a/plugins/websocket/examples/tauri-app/src-tauri/Cargo.toml b/plugins/websocket/examples/tauri-app/src-tauri/Cargo.toml index e86f4677..c80fbb29 100644 --- a/plugins/websocket/examples/tauri-app/src-tauri/Cargo.toml +++ b/plugins/websocket/examples/tauri-app/src-tauri/Cargo.toml @@ -7,7 +7,7 @@ edition = "2021" [dependencies] serde = { workspace = true } serde_json = { workspace = true } -tauri = { workspace = true } +tauri = { workspace = true, features = ["wry", "compression"] } tokio = { version = "1", features = ["net"] } futures-util = "0.3" tauri-plugin-websocket = { path = "../../../" }