Bladeren bron

chore(deps) Update Tauri API (#1072)

Co-authored-by: Renovate Bot <bot@renovateapp.com>
Co-authored-by: Lucas Nogueira <lucas@tauri.studio>
renovate[bot] 4 jaren geleden
bovenliggende
commit
b4544b63f2

+ 5 - 0
.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.

+ 0 - 3
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.";

+ 0 - 6
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() {

+ 0 - 4
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;

+ 2 - 2
cli/tauri-bundler/src/bundle/dmg_bundle.rs

@@ -27,7 +27,7 @@ pub fn bundle_project(settings: &Settings) -> crate::Result<Vec<PathBuf>> {
     }
   );
   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<Vec<PathBuf>> {
   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(

+ 0 - 1
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};
 

+ 0 - 3
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;

+ 2 - 8
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() {

+ 1 - 1
rust-toolchain

@@ -1 +1 @@
-1.42.0
+1.47.0

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

+ 1 - 1
tauri-api/src/dir.rs

@@ -53,7 +53,7 @@ pub fn read_dir<P: AsRef<Path>>(path: P, recursive: bool) -> crate::Result<Vec<D
 }
 
 /// Runs a closure with a temp dir argument.
-pub fn with_temp_dir<F: FnOnce(&tempfile::TempDir) -> ()>(callback: F) -> crate::Result<()> {
+pub fn with_temp_dir<F: FnOnce(&tempfile::TempDir)>(callback: F) -> crate::Result<()> {
   let dir = tempdir()?;
   callback(&dir);
   dir.close()?;

+ 2 - 6
tauri-api/src/file.rs

@@ -11,16 +11,12 @@ pub use file_move::*;
 
 /// Reads a string file.
 pub fn read_string<P: AsRef<Path>>(file: P) -> crate::Result<String> {
-  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<P: AsRef<Path>>(file: P) -> crate::Result<Vec<u8>> {
-  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)]

+ 0 - 3
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;

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

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

+ 1 - 0
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,

+ 1 - 1
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<F: FnOnce() -> () + Send + 'static>(task: F) {
+pub fn spawn<F: FnOnce() + Send + 'static>(task: F) {
   POOL.with(|thread| {
     thread.execute(move || {
       task();

+ 1 - 0
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<std::io::Cursor<Vec<u8>>> {
   let asset_path = &format!(
     "{}{}",