Skip to content

Commit

Permalink
chore(deps) Update Tauri API (#1072)
Browse files Browse the repository at this point in the history
Co-authored-by: Renovate Bot <bot@renovateapp.com>
Co-authored-by: Lucas Nogueira <lucas@tauri.studio>
  • Loading branch information
3 people committed Nov 7, 2020
1 parent 9e0b3d8 commit b4544b6
Show file tree
Hide file tree
Showing 18 changed files with 18 additions and 44 deletions.
5 changes: 5 additions & 0 deletions .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.
3 changes: 0 additions & 3 deletions 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.";
Expand Down
6 changes: 0 additions & 6 deletions 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](
Expand Down Expand Up @@ -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() {
Expand Down
4 changes: 0 additions & 4 deletions cli/tauri-bundler/src/bundle/deb_bundle.rs
Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions cli/tauri-bundler/src/bundle/dmg_bundle.rs
Expand Up @@ -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");
Expand All @@ -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(
Expand Down
1 change: 0 additions & 1 deletion cli/tauri-bundler/src/bundle/ios_bundle.rs
Expand Up @@ -12,7 +12,6 @@ use super::common;
use crate::Settings;

use anyhow::Context;
use icns;
use image::png::PngDecoder;
use image::{self, GenericImageView, ImageDecoder};

Expand Down
3 changes: 0 additions & 3 deletions cli/tauri-bundler/src/bundle/osx_bundle.rs
Expand Up @@ -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;
Expand Down
10 changes: 2 additions & 8 deletions cli/tauri-bundler/src/bundle/settings.rs
Expand Up @@ -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;
Expand Down Expand Up @@ -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)?;
Expand Down Expand Up @@ -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() {
Expand Down
2 changes: 1 addition & 1 deletion rust-toolchain
@@ -1 +1 @@
1.42.0
1.47.0
4 changes: 2 additions & 2 deletions tauri-api/Cargo.toml
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion tauri-api/src/dir.rs
Expand Up @@ -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()?;
Expand Down
8 changes: 2 additions & 6 deletions tauri-api/src/file.rs
Expand Up @@ -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)]
Expand Down
3 changes: 0 additions & 3 deletions 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;
Expand Down
1 change: 0 additions & 1 deletion 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.
Expand Down
2 changes: 0 additions & 2 deletions 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
Expand Down
1 change: 1 addition & 0 deletions 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,
Expand Down
2 changes: 1 addition & 1 deletion tauri/src/lib.rs
Expand Up @@ -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();
Expand Down
1 change: 1 addition & 0 deletions 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!(
"{}{}",
Expand Down

0 comments on commit b4544b6

Please sign in to comment.