Parcourir la source

fix: clippy warnings (#10415)

Lucas Fernandes Nogueira il y a 1 an
Parent
commit
b59b755a4b

+ 8 - 8
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<Value, ConfigError> {
@@ -224,15 +224,15 @@ pub fn does_supported_file_name_exist(path: impl Into<PathBuf>) -> 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<PathBuf>) -> Result<(Config, PathBuf), ConfigError> {
   do_parse(path.into())

+ 2 - 2
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`

+ 2 - 0
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<String>,
@@ -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<String>,

+ 1 - 1
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.

+ 3 - 3
core/tauri/src/window.rs

@@ -1713,7 +1713,7 @@ impl<R: Runtime> Window<R> {
   /// ## 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<R: Runtime> Window<R> {
   /// ## 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<R: Runtime> Window<R> {
   /// ## 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