diff --git a/.changes/rust-version.md b/.changes/rust-version.md new file mode 100644 index 000000000..335a65dce --- /dev/null +++ b/.changes/rust-version.md @@ -0,0 +1,5 @@ +--- +"tauri": minor +--- + +Minimum Rust version updated to 1.47.0. Run `$ rustup update` to update to the latest version. diff --git a/cli/tauri-bundler/src/bundle/category.rs b/cli/tauri-bundler/src/bundle/category.rs index ae260803f..75fec67b5 100644 --- a/cli/tauri-bundler/src/bundle/category.rs +++ b/cli/tauri-bundler/src/bundle/category.rs @@ -1,8 +1,5 @@ use std::fmt; -use serde; -use strsim; - const CONFIDENCE_THRESHOLD: f64 = 0.8; const OSX_APP_CATEGORY_PREFIX: &str = "public.app-category."; diff --git a/cli/tauri-bundler/src/bundle/common.rs b/cli/tauri-bundler/src/bundle/common.rs index 153ac6a7b..202c56ba2 100644 --- a/cli/tauri-bundler/src/bundle/common.rs +++ b/cli/tauri-bundler/src/bundle/common.rs @@ -1,14 +1,10 @@ use crate::Settings; -use std; use std::ffi::OsStr; use std::fs::{self, File}; use std::io::{self, BufRead, BufReader, BufWriter, Write}; use std::path::{Component, Path, PathBuf}; use std::process::{Command, Stdio}; -use term; -use walkdir; - /// Returns true if the path has a filename indicating that it is a high-desity /// "retina" icon. Specifically, returns true the the file stem ends with /// "@2x" (a convention specified by the [Apple developer docs]( @@ -300,10 +296,8 @@ pub fn execute_with_verbosity(cmd: &mut Command, settings: &Settings) -> crate:: #[cfg(test)] mod tests { use super::{copy_dir, create_file, is_retina, resource_relpath, symlink_file}; - use std; use std::io::Write; use std::path::PathBuf; - use tempfile; #[test] fn create_file_with_parent_dirs() { diff --git a/cli/tauri-bundler/src/bundle/deb_bundle.rs b/cli/tauri-bundler/src/bundle/deb_bundle.rs index f6e29f8f3..28e5b3f9d 100644 --- a/cli/tauri-bundler/src/bundle/deb_bundle.rs +++ b/cli/tauri-bundler/src/bundle/deb_bundle.rs @@ -22,14 +22,10 @@ use super::common; use crate::Settings; use anyhow::Context; -use ar; -use icns; use image::png::PngDecoder; use image::{self, GenericImageView, ImageDecoder}; use libflate::gzip; -use md5; use std::process::{Command, Stdio}; -use tar; use walkdir::WalkDir; use std::collections::BTreeSet; diff --git a/cli/tauri-bundler/src/bundle/dmg_bundle.rs b/cli/tauri-bundler/src/bundle/dmg_bundle.rs index 37443c470..55339f664 100644 --- a/cli/tauri-bundler/src/bundle/dmg_bundle.rs +++ b/cli/tauri-bundler/src/bundle/dmg_bundle.rs @@ -27,7 +27,7 @@ pub fn bundle_project(settings: &Settings) -> crate::Result> { } ); let dmg_name = format!("{}.dmg", &package_base_name); - let dmg_path = output_path.join(&dmg_name.clone()); + let dmg_path = output_path.join(&dmg_name); let bundle_name = &format!("{}.app", &package_base_name); let bundle_dir = settings.project_out_directory().join("bundle/osx"); @@ -49,7 +49,7 @@ pub fn bundle_project(settings: &Settings) -> crate::Result> { let bundle_script_path = output_path.join("bundle_dmg.sh"); let license_script_path = support_directory_path.join("dmg-license.py"); - common::print_bundling(format!("{:?}", &dmg_path.clone()).as_str())?; + common::print_bundling(format!("{:?}", &dmg_path).as_str())?; // write the scripts write( diff --git a/cli/tauri-bundler/src/bundle/ios_bundle.rs b/cli/tauri-bundler/src/bundle/ios_bundle.rs index 5a2fee2a5..2026ead6e 100644 --- a/cli/tauri-bundler/src/bundle/ios_bundle.rs +++ b/cli/tauri-bundler/src/bundle/ios_bundle.rs @@ -12,7 +12,6 @@ use super::common; use crate::Settings; use anyhow::Context; -use icns; use image::png::PngDecoder; use image::{self, GenericImageView, ImageDecoder}; diff --git a/cli/tauri-bundler/src/bundle/osx_bundle.rs b/cli/tauri-bundler/src/bundle/osx_bundle.rs index 9baec22a2..72eda55cf 100644 --- a/cli/tauri-bundler/src/bundle/osx_bundle.rs +++ b/cli/tauri-bundler/src/bundle/osx_bundle.rs @@ -21,9 +21,6 @@ use super::common; use crate::Settings; use anyhow::Context; -use chrono; -use dirs_next; -use icns; use image::{self, GenericImageView}; use std::cmp::min; diff --git a/cli/tauri-bundler/src/bundle/settings.rs b/cli/tauri-bundler/src/bundle/settings.rs index 8d12c1bfd..94f7b8313 100644 --- a/cli/tauri-bundler/src/bundle/settings.rs +++ b/cli/tauri-bundler/src/bundle/settings.rs @@ -3,13 +3,9 @@ use crate::bundle::common; use crate::bundle::platform::target_triple; use clap::ArgMatches; -use glob; use serde::Deserialize; use target_build_utils::TargetInfo; -use toml; -use walkdir; -use std; use std::collections::HashMap; use std::fs::File; use std::io::Read; @@ -433,10 +429,9 @@ impl Settings { } if binaries.len() == 1 { - binaries.get_mut(0).and_then(|bin| { + if let Some(bin) = binaries.get_mut(0) { bin.main = true; - Some(bin) - }); + } } let bundle_settings = parse_external_bin(bundle_settings)?; @@ -961,7 +956,6 @@ impl<'a> Iterator for ResourcePaths<'a> { #[cfg(test)] mod tests { use super::{AppCategory, BundleSettings, CargoSettings}; - use toml; #[test] fn parse_cargo_toml() { diff --git a/rust-toolchain b/rust-toolchain index a50908ca3..21998d3c2 100644 --- a/rust-toolchain +++ b/rust-toolchain @@ -1 +1 @@ -1.42.0 +1.47.0 diff --git a/tauri-api/Cargo.toml b/tauri-api/Cargo.toml index 311513ba5..1857ff987 100644 --- a/tauri-api/Cargo.toml +++ b/tauri-api/Cargo.toml @@ -25,8 +25,8 @@ tempfile = "3" either = "1.6.1" tar = "0.4" flate2 = "1" -anyhow = "1.0.33" -thiserror = "1.0.21" +anyhow = "1.0.34" +thiserror = "1.0.22" rand = "0.7" nfd = "0.0.4" tauri-dialog = "0.1.0" diff --git a/tauri-api/src/dir.rs b/tauri-api/src/dir.rs index 4c193dae4..8d5bd43dd 100644 --- a/tauri-api/src/dir.rs +++ b/tauri-api/src/dir.rs @@ -53,7 +53,7 @@ pub fn read_dir>(path: P, recursive: bool) -> crate::Result ()>(callback: F) -> crate::Result<()> { +pub fn with_temp_dir(callback: F) -> crate::Result<()> { let dir = tempdir()?; callback(&dir); dir.close()?; diff --git a/tauri-api/src/file.rs b/tauri-api/src/file.rs index e04ee05d7..146532a4a 100644 --- a/tauri-api/src/file.rs +++ b/tauri-api/src/file.rs @@ -11,16 +11,12 @@ pub use file_move::*; /// Reads a string file. pub fn read_string>(file: P) -> crate::Result { - fs::read_to_string(file) - .map_err(|err| Error::File(format!("Read_string failed: {}", err)).into()) - .map(|c| c) + fs::read_to_string(file).map_err(|err| Error::File(format!("Read_string failed: {}", err)).into()) } /// Reads a binary file. pub fn read_binary>(file: P) -> crate::Result> { - fs::read(file) - .map_err(|err| Error::File(format!("Read_binary failed: {}", err)).into()) - .map(|b| b) + fs::read(file).map_err(|err| Error::File(format!("Read_binary failed: {}", err)).into()) } #[cfg(test)] diff --git a/tauri-api/src/file/extract.rs b/tauri-api/src/file/extract.rs index d555e5a91..1bc8f54cf 100644 --- a/tauri-api/src/file/extract.rs +++ b/tauri-api/src/file/extract.rs @@ -1,7 +1,4 @@ use either::{self, Either}; -use flate2; -use tar; -use zip; use std::fs; use std::io; diff --git a/tauri-api/src/tcp.rs b/tauri-api/src/tcp.rs index 4e654cef4..41ea1d393 100644 --- a/tauri-api/src/tcp.rs +++ b/tauri-api/src/tcp.rs @@ -1,6 +1,5 @@ use std::net::TcpListener; -use rand; use rand::distributions::{Distribution, Uniform}; /// Gets the first available port between 8000 and 9000. diff --git a/tauri-utils/src/process.rs b/tauri-utils/src/process.rs index 4b76c57b8..a9ffedc99 100644 --- a/tauri-utils/src/process.rs +++ b/tauri-utils/src/process.rs @@ -1,7 +1,5 @@ use crate::Error; -use sysinfo; - pub use sysinfo::{Process, ProcessExt, Signal, System, SystemExt}; /// Gets the parent process diff --git a/tauri/src/endpoints/asset.rs b/tauri/src/endpoints/asset.rs index 0f30f205d..8c8e4940d 100644 --- a/tauri/src/endpoints/asset.rs +++ b/tauri/src/endpoints/asset.rs @@ -1,6 +1,7 @@ use std::path::PathBuf; use webview_official::Webview; +#[allow(clippy::option_env_unwrap)] pub fn load( webview: &mut Webview<'_>, asset: String, diff --git a/tauri/src/lib.rs b/tauri/src/lib.rs index 2375ce4c9..cf0f5d64a 100644 --- a/tauri/src/lib.rs +++ b/tauri/src/lib.rs @@ -50,7 +50,7 @@ use threadpool::ThreadPool; thread_local!(static POOL: ThreadPool = ThreadPool::new(4)); /// Executes the operation in the thread pool. -pub fn spawn () + Send + 'static>(task: F) { +pub fn spawn(task: F) { POOL.with(|thread| { thread.execute(move || { task(); diff --git a/tauri/src/server.rs b/tauri/src/server.rs index 880cf791b..cc2685b7d 100644 --- a/tauri/src/server.rs +++ b/tauri/src/server.rs @@ -1,6 +1,7 @@ use tiny_http::{Header, Response}; /// Returns the HTTP response of the given asset path. +#[allow(clippy::option_env_unwrap)] pub fn asset_response(path: &str) -> Response>> { let asset_path = &format!( "{}{}",