From b59b755a4b4caa81806fe4beb8456ec7603ebadb Mon Sep 17 00:00:00 2001 From: Lucas Fernandes Nogueira Date: Mon, 29 Jul 2024 18:08:59 -0300 Subject: [PATCH] fix: clippy warnings (#10415) --- core/tauri-utils/src/config/parse.rs | 16 ++++++++-------- core/tauri/src/api/notification.rs | 4 ++-- core/tauri/src/endpoints/dialog.rs | 2 ++ core/tauri/src/lib.rs | 2 +- core/tauri/src/window.rs | 6 +++--- 5 files changed, 16 insertions(+), 14 deletions(-) diff --git a/core/tauri-utils/src/config/parse.rs b/core/tauri-utils/src/config/parse.rs index a643fb1aeacd..e344f6cd1f57 100644 --- a/core/tauri-utils/src/config/parse.rs +++ b/core/tauri-utils/src/config/parse.rs @@ -175,7 +175,7 @@ pub fn is_configuration_file(path: &Path) -> bool { /// - `tauri.macos.conf.json[5]` on macOS /// - `tauri.linux.conf.json[5]` on Linux /// - `tauri.windows.conf.json[5]` on Windows -/// Merging the configurations using [JSON Merge Patch (RFC 7396)]. +/// Merging the configurations using [JSON Merge Patch (RFC 7396)]. /// /// [JSON Merge Patch (RFC 7396)]: https://datatracker.ietf.org/doc/html/rfc7396. pub fn read_from(root_dir: PathBuf) -> Result { @@ -224,15 +224,15 @@ pub fn does_supported_file_name_exist(path: impl Into) -> bool { /// /// Hierarchy: /// 1. Check if `tauri.conf.json` exists -/// a. Parse it with `serde_json` -/// b. Parse it with `json5` if `serde_json` fails -/// c. Return original `serde_json` error if all above steps failed +/// a. Parse it with `serde_json` +/// b. Parse it with `json5` if `serde_json` fails +/// c. Return original `serde_json` error if all above steps failed /// 2. Check if `tauri.conf.json5` exists -/// a. Parse it with `json5` -/// b. Return error if all above steps failed +/// a. Parse it with `json5` +/// b. Return error if all above steps failed /// 3. Check if `Tauri.json` exists -/// a. Parse it with `toml` -/// b. Return error if all above steps failed +/// a. Parse it with `toml` +/// b. Return error if all above steps failed /// 4. Return error if all above steps failed pub fn parse(path: impl Into) -> Result<(Config, PathBuf), ConfigError> { do_parse(path.into()) diff --git a/core/tauri/src/api/notification.rs b/core/tauri/src/api/notification.rs index 019696ee6c2e..e48519a1f366 100644 --- a/core/tauri/src/api/notification.rs +++ b/core/tauri/src/api/notification.rs @@ -61,8 +61,8 @@ pub enum Sound { /// if `ms-winsoundevent:Notification.Looping.Alarm2`, you would use `Alarm2`. /// Windows 7 is not supported, if a sound is provided, it will play the default sound, otherwise it will be silent. /// - **macOS**: you can specify the name of the sound you'd like to play when the notification is shown. - /// Any of the default sounds (under System Preferences > Sound) can be used, in addition to custom sound files. - /// Be sure that the sound file is under one of the following locations: + /// Any of the default sounds (under System Preferences > Sound) can be used, in addition to custom sound files. + /// Be sure that the sound file is under one of the following locations: /// - `~/Library/Sounds` /// - `/Library/Sounds` /// - `/Network/Library/Sounds` diff --git a/core/tauri/src/endpoints/dialog.rs b/core/tauri/src/endpoints/dialog.rs index 0cb7cccb317a..f759064c1cb9 100644 --- a/core/tauri/src/endpoints/dialog.rs +++ b/core/tauri/src/endpoints/dialog.rs @@ -52,6 +52,7 @@ pub struct DialogFilter { /// The options for the open dialog API. #[derive(Debug, Clone, Deserialize)] #[serde(rename_all = "camelCase")] +#[cfg_attr(not(dialog_open), allow(dead_code))] pub struct OpenDialogOptions { /// The title of the dialog window. pub title: Option, @@ -75,6 +76,7 @@ pub struct OpenDialogOptions { /// The options for the save dialog API. #[derive(Debug, Clone, Deserialize)] #[serde(rename_all = "camelCase")] +#[cfg_attr(not(dialog_save), allow(dead_code))] pub struct SaveDialogOptions { /// The title of the dialog window. pub title: Option, diff --git a/core/tauri/src/lib.rs b/core/tauri/src/lib.rs index 484b81d45ca3..e62da03bffe9 100644 --- a/core/tauri/src/lib.rs +++ b/core/tauri/src/lib.rs @@ -20,7 +20,7 @@ //! - **custom-protocol**: Feature managed by the Tauri CLI. When enabled, Tauri assumes a production environment instead of a development one. //! - **updater**: Enables the application auto updater. Enabled by default if the `updater` config is defined on the `tauri.conf.json` file. //! - **devtools**: Enables the developer tools (Web inspector) and [`Window::open_devtools`]. Enabled by default on debug builds. -//! On macOS it uses private APIs, so you can't enable it if your app will be published to the App Store. +//! On macOS it uses private APIs, so you can't enable it if your app will be published to the App Store. //! - **shell-open-api**: Enables the [`api::shell`] module. //! - **http-api**: Enables the [`api::http`] module. //! - **http-multipart**: Adds support to `multipart/form-data` requests. diff --git a/core/tauri/src/window.rs b/core/tauri/src/window.rs index 5492d1e165c1..7029b78c7075 100644 --- a/core/tauri/src/window.rs +++ b/core/tauri/src/window.rs @@ -1713,7 +1713,7 @@ impl Window { /// ## Platform-specific /// /// - **macOS:** Only supported on macOS 10.15+. - /// This is a private API on macOS, so you cannot use this if your application will be published on the App Store. + /// This is a private API on macOS, so you cannot use this if your application will be published on the App Store. /// /// # Examples /// @@ -1738,7 +1738,7 @@ impl Window { /// ## Platform-specific /// /// - **macOS:** Only supported on macOS 10.15+. - /// This is a private API on macOS, so you cannot use this if your application will be published on the App Store. + /// This is a private API on macOS, so you cannot use this if your application will be published on the App Store. /// - **Windows:** Unsupported. /// /// # Examples @@ -1771,7 +1771,7 @@ impl Window { /// ## Platform-specific /// /// - **macOS:** Only supported on macOS 10.15+. - /// This is a private API on macOS, so you cannot use this if your application will be published on the App Store. + /// This is a private API on macOS, so you cannot use this if your application will be published on the App Store. /// - **Windows:** Unsupported. /// /// # Examples