chore: edition 2024

This commit is contained in:
Lucas Nogueira
2026-09-26 15:36:22 -03:00
parent b517cc7e85
commit 3d8a3c877b
100 changed files with 276 additions and 253 deletions
@@ -5,7 +5,7 @@ description = "A Tauri App"
authors = ["you"]
license = ""
repository = ""
edition = "2021"
edition = "2024"
rust-version = "1.90"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
+1 -1
View File
@@ -2,7 +2,7 @@
// SPDX-License-Identifier: Apache-2.0
// SPDX-License-Identifier: MIT
use tauri::{command, AppHandle, Runtime, State, Window};
use tauri::{AppHandle, Runtime, State, Window, command};
use crate::{DeepLink, Result};
+5 -4
View File
@@ -50,7 +50,9 @@ impl AssociatedDomain {
}
if self.scheme.iter().any(|s| s == "http") && !self.scheme.iter().any(|s| s == "https")
{
eprintln!("Warning: AppLink uses only 'http' — allowed on Android but not secure for production.");
eprintln!(
"Warning: AppLink uses only 'http' — allowed on Android but not secure for production."
);
}
}
@@ -68,13 +70,12 @@ where
D: Deserializer<'de>,
{
let opt = Option::<String>::deserialize(deserializer)?;
if let Some(ref host) = opt {
if let Some((scheme, _)) = host.split_once("://") {
if let Some(ref host) = opt
&& let Some((scheme, _)) = host.split_once("://") {
return Err(serde::de::Error::custom(format!(
"host `{host}` cannot start with a scheme, please remove the `{scheme}://` prefix"
)));
}
}
Ok(opt)
}
+1 -1
View File
@@ -2,7 +2,7 @@
// SPDX-License-Identifier: Apache-2.0
// SPDX-License-Identifier: MIT
use serde::{ser::Serializer, Serialize};
use serde::{Serialize, ser::Serializer};
/// Alias for a [`Result`](std::result::Result) with the error type [`Error`].
pub type Result<T> = std::result::Result<T, Error>;
+13 -12
View File
@@ -11,8 +11,8 @@
//! calling those methods returns [`Error::UnsupportedPlatform`].
use tauri::{
plugin::{Builder, PluginApi, TauriPlugin},
AppHandle, EventId, Listener, Manager, Runtime,
plugin::{Builder, PluginApi, TauriPlugin},
};
mod commands;
@@ -33,8 +33,8 @@ fn init_deep_link<R: Runtime>(
let _api = api;
use tauri::{
ipc::{Channel, InvokeResponseBody},
Emitter,
ipc::{Channel, InvokeResponseBody},
};
let handle = _api.register_android_plugin(PLUGIN_IDENTIFIER, "DeepLinkPlugin")?;
@@ -94,7 +94,7 @@ fn init_deep_link<R: Runtime>(
#[cfg(target_os = "android")]
mod imp {
use tauri::{ipc::Channel, plugin::PluginHandle, AppHandle, Runtime};
use tauri::{AppHandle, Runtime, ipc::Channel, plugin::PluginHandle};
use serde::{Deserialize, Serialize};
@@ -172,7 +172,7 @@ mod imp {
use std::sync::Mutex;
#[cfg(target_os = "linux")]
use std::{
fs::{create_dir_all, File},
fs::{File, create_dir_all},
io::Write,
process::Command,
};
@@ -223,7 +223,9 @@ mod imp {
current.replace(vec![url.clone()]);
let _ = self.app.emit("deep-link://new-url", vec![url]);
} else if cfg!(debug_assertions) {
tracing::warn!("argument {url} does not match any configured deep link scheme; skipping it");
tracing::warn!(
"argument {url} does not match any configured deep link scheme; skipping it"
);
}
}
}
@@ -414,11 +416,10 @@ mod imp {
let mimeapps_path = self.app.path().config_dir()?.join("mimeapps.list");
if mimeapps_path.exists() {
let mut mimeapps = ini::Ini::load_from_file(&mimeapps_path)?;
if let Some(section) = mimeapps.section_mut(Some("Default Applications")) {
if section.get(&mime_type).unwrap_or_default() == file_name {
if let Some(section) = mimeapps.section_mut(Some("Default Applications"))
&& section.get(&mime_type).unwrap_or_default() == file_name {
section.remove(&mime_type);
}
}
mimeapps.write_to_file(&mimeapps_path)?;
}
@@ -558,16 +559,16 @@ impl<R: Runtime> DeepLink<R> {
///
/// Use `get_current` on app load to check whether your app was started via a deep link.
pub fn on_open_url<F: Fn(OpenUrlEvent) + Send + Sync + 'static>(&self, f: F) -> EventId {
let event_id = self.app.listen("deep-link://new-url", move |event| {
self.app.listen("deep-link://new-url", move |event| {
if let Ok(urls) = serde_json::from_str(event.payload()) {
f(OpenUrlEvent {
id: event.id(),
urls,
})
}
});
event_id
})
}
}