chore(fmt): merge imports (#1216)

This commit is contained in:
Lucas Fernandes Nogueira 2021-02-11 03:22:42 -03:00 committed by GitHub
parent 84d7cdae63
commit 35468f68e5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
44 changed files with 191 additions and 164 deletions

View File

@ -1,9 +1,11 @@
use std::env;
use std::env::current_dir;
use std::error::Error;
use std::fs::{read_to_string, File};
use std::io::{BufWriter, Write};
use std::path::Path;
use std::{
env,
env::current_dir,
error::Error,
fs::{read_to_string, File},
io::{BufWriter, Write},
path::Path,
};
pub fn main() -> Result<(), Box<dyn Error>> {
let out_dir = env::var("OUT_DIR")?;

View File

@ -10,11 +10,13 @@ use crate::helpers::{
manifest::rewrite_manifest,
TauriScript,
};
use std::env::{set_current_dir, set_var};
use std::fs::File;
use std::io::Write;
use std::path::PathBuf;
use std::process::Command;
use std::{
env::{set_current_dir, set_var},
fs::File,
io::Write,
path::PathBuf,
process::Command,
};
#[derive(Default)]
pub struct Build {

View File

@ -8,15 +8,19 @@ use crate::helpers::{
use notify::{watcher, DebouncedEvent, RecursiveMode, Watcher};
use shared_child::SharedChild;
use std::env::{set_current_dir, set_var};
use std::ffi::OsStr;
use std::fs::File;
use std::io::Write;
use std::path::PathBuf;
use std::process::{exit, Command};
use std::sync::mpsc::{channel, Receiver};
use std::sync::{Arc, Mutex};
use std::time::Duration;
use std::{
env::{set_current_dir, set_var},
ffi::OsStr,
fs::File,
io::Write,
path::PathBuf,
process::{exit, Command},
sync::{
mpsc::{channel, Receiver},
Arc, Mutex,
},
time::Duration,
};
#[derive(Default)]
pub struct Dev {

View File

@ -1,5 +1,4 @@
use std::env::current_dir;
use std::path::PathBuf;
use std::{env::current_dir, path::PathBuf};
use once_cell::sync::Lazy;

View File

@ -1,14 +1,18 @@
use json_patch::merge;
use once_cell::sync::Lazy;
use serde::de::{Deserializer, Error as DeError, Visitor};
use serde::ser::Serializer;
use serde::{Deserialize, Serialize};
use serde::{
de::{Deserializer, Error as DeError, Visitor},
ser::Serializer,
Deserialize, Serialize,
};
use serde_json::Value as JsonValue;
use std::collections::HashMap;
use std::fs::File;
use std::io::BufReader;
use std::sync::{Arc, Mutex};
use std::{
collections::HashMap,
fs::File,
io::BufReader,
sync::{Arc, Mutex},
};
pub type ConfigHandle = Arc<Mutex<Option<Config>>>;

View File

@ -3,8 +3,10 @@ use super::{app_paths::tauri_dir, config::ConfigHandle};
use convert_case::{Case, Casing};
use toml_edit::{Array, Document, Value};
use std::fs::File;
use std::io::{Read, Write};
use std::{
fs::File,
io::{Read, Write},
};
pub fn rewrite_manifest(config: ConfigHandle) -> crate::Result<()> {
let manifest_path = tauri_dir().join("Cargo.toml");

View File

@ -7,8 +7,10 @@ mod tauri_entry;
pub use logger::Logger;
pub use tauri_entry::TauriScript;
use std::io::{BufRead, BufReader};
use std::process::{Command, Stdio};
use std::{
io::{BufRead, BufReader},
process::{Command, Stdio},
};
pub fn execute_with_output(cmd: &mut Command) -> crate::Result<()> {
let mut child = cmd

View File

@ -1,7 +1,6 @@
#![allow(dead_code)]
use std::convert::TryFrom;
use std::path::PathBuf;
use std::{convert::TryFrom, path::PathBuf};
pub enum ForceType {
All,

View File

@ -11,3 +11,4 @@ merge_derives = true
use_try_shorthand = false
use_field_init_shorthand = false
force_explicit_abi = true
imports_granularity = "Crate"

View File

@ -20,9 +20,10 @@ use std::process::Command;
#[cfg(windows)]
use tauri_config::get as get_tauri_config;
pub use self::common::print_error;
pub use self::common::print_info;
pub use self::settings::{PackageType, Settings, SettingsBuilder};
pub use self::{
common::{print_error, print_info},
settings::{PackageType, Settings, SettingsBuilder},
};
use common::print_finished;
use std::path::PathBuf;

View File

@ -1,15 +1,15 @@
use super::common;
use super::deb_bundle;
use super::path_utils;
use super::{common, deb_bundle, path_utils};
use crate::Settings;
use handlebars::Handlebars;
use lazy_static::lazy_static;
use std::collections::BTreeMap;
use std::fs::{remove_dir_all, write};
use std::path::PathBuf;
use std::process::{Command, Stdio};
use std::{
collections::BTreeMap,
fs::{remove_dir_all, write},
path::PathBuf,
process::{Command, Stdio},
};
// Create handlebars template for shell script
lazy_static! {

View File

@ -1,9 +1,11 @@
use crate::Settings;
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 std::{
ffi::OsStr,
fs::{self, File},
io::{self, BufRead, BufReader, BufWriter, Write},
path::{Component, Path, PathBuf},
process::{Command, Stdio},
};
use termcolor::{Color, ColorChoice, ColorSpec, StandardStream, WriteColor};
/// Returns true if the path has a filename indicating that it is a high-desity
@ -246,8 +248,7 @@ 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::io::Write;
use std::path::PathBuf;
use std::{io::Write, path::PathBuf};
#[test]
fn create_file_with_parent_dirs() {

View File

@ -22,17 +22,18 @@ use super::common;
use crate::Settings;
use anyhow::Context;
use image::png::PngDecoder;
use image::{self, GenericImageView, ImageDecoder};
use image::{self, png::PngDecoder, GenericImageView, ImageDecoder};
use libflate::gzip;
use std::process::{Command, Stdio};
use walkdir::WalkDir;
use std::collections::BTreeSet;
use std::ffi::OsStr;
use std::fs::{self, File};
use std::io::{self, Write};
use std::path::{Path, PathBuf};
use std::{
collections::BTreeSet,
ffi::OsStr,
fs::{self, File},
io::{self, Write},
path::{Path, PathBuf},
};
/// Bundles the project.
/// Returns a vector of PathBuf that shows where the DEB was created.

View File

@ -1,13 +1,14 @@
use super::common;
use super::osx_bundle;
use super::{common, osx_bundle};
use crate::Settings;
use anyhow::Context;
use std::env;
use std::fs::{self, write};
use std::path::PathBuf;
use std::process::{Command, Stdio};
use std::{
env,
fs::{self, write},
path::PathBuf,
process::{Command, Stdio},
};
/// Bundles the project.
/// Returns a vector of PathBuf that shows where the DMG was created.

View File

@ -12,14 +12,15 @@ use super::common;
use crate::Settings;
use anyhow::Context;
use image::png::PngDecoder;
use image::{self, GenericImageView, ImageDecoder};
use image::{self, png::PngDecoder, GenericImageView, ImageDecoder};
use std::collections::BTreeSet;
use std::ffi::OsStr;
use std::fs::{self, File};
use std::io::Write;
use std::path::{Path, PathBuf};
use std::{
collections::BTreeSet,
ffi::OsStr,
fs::{self, File},
io::Write,
path::{Path, PathBuf},
};
/// Bundles the project.
/// Returns a vector of PathBuf that shows where the .app was created.

View File

@ -1,8 +1,6 @@
use super::settings::Settings;
use super::wix;
use super::{settings::Settings, wix};
use std;
use std::path::PathBuf;
use std::{self, path::PathBuf};
/// Runs all of the commands to build the MSI installer.
/// Returns a vector of PathBuf that shows where the MSI was created.

View File

@ -23,13 +23,14 @@ use crate::Settings;
use anyhow::Context;
use image::{self, GenericImageView};
use std::cmp::min;
use std::ffi::OsStr;
use std::fs::{self, File};
use std::io::prelude::*;
use std::io::{self, BufWriter};
use std::path::{Path, PathBuf};
use std::process::{Command, Stdio};
use std::{
cmp::min,
ffi::OsStr,
fs::{self, File},
io::{self, prelude::*, BufWriter},
path::{Path, PathBuf},
process::{Command, Stdio},
};
/// Bundles the project.
/// Returns a vector of PathBuf that shows where the .app was created.

View File

@ -1,5 +1,7 @@
use std::fs::{create_dir, create_dir_all, read_dir, remove_dir_all};
use std::path::{Path, PathBuf};
use std::{
fs::{create_dir, create_dir_all, read_dir, remove_dir_all},
path::{Path, PathBuf},
};
/// Directory options.
#[derive(Clone)]

View File

@ -1,14 +1,15 @@
use super::category::AppCategory;
use crate::bundle::common;
use crate::bundle::platform::target_triple;
use crate::bundle::{common, platform::target_triple};
use serde::Deserialize;
use target_build_utils::TargetInfo;
use std::collections::HashMap;
use std::fs::File;
use std::io::Read;
use std::path::{Path, PathBuf};
use std::{
collections::HashMap,
fs::File,
io::Read,
path::{Path, PathBuf},
};
/// The type of the package we're bundling.
#[derive(Clone, Copy, Debug, Eq, PartialEq)]

View File

@ -1,6 +1,8 @@
use super::common;
use super::path_utils::{copy, Options};
use super::settings::Settings;
use super::{
common,
path_utils::{copy, Options},
settings::Settings,
};
use handlebars::{to_json, Handlebars};
use lazy_static::lazy_static;
@ -10,11 +12,13 @@ use sha2::Digest;
use uuid::Uuid;
use zip::ZipArchive;
use std::collections::BTreeMap;
use std::fs::{create_dir_all, remove_dir_all, write, File};
use std::io::{Cursor, Read, Write};
use std::path::{Path, PathBuf};
use std::process::{Command, Stdio};
use std::{
collections::BTreeMap,
fs::{create_dir_all, remove_dir_all, write, File},
io::{Cursor, Read, Write},
path::{Path, PathBuf},
process::{Command, Stdio},
};
// URLS for the WIX toolchain. Can be used for crossplatform compilation.
pub const WIX_URL: &str =

View File

@ -11,3 +11,4 @@ merge_derives = true
use_try_shorthand = false
use_field_init_shorthand = false
force_explicit_abi = true
imports_granularity = "Crate"

View File

@ -11,3 +11,4 @@ merge_derives = true
use_try_shorthand = false
use_field_init_shorthand = false
force_explicit_abi = true
imports_granularity = "Crate"

View File

@ -11,3 +11,4 @@ merge_derives = true
use_try_shorthand = false
use_field_init_shorthand = false
force_explicit_abi = true
imports_granularity = "Crate"

View File

@ -1,6 +1,8 @@
use serde::Serialize;
use std::fs::{self, metadata};
use std::path::{Path, PathBuf};
use std::{
fs::{self, metadata},
path::{Path, PathBuf},
};
use tempfile::{self, tempdir};
/// The result of the `read_dir` function.
@ -64,8 +66,7 @@ pub fn with_temp_dir<F: FnOnce(&tempfile::TempDir)>(callback: F) -> crate::Resul
mod test {
use super::*;
use quickcheck_macros::quickcheck;
use std::ffi::OsStr;
use std::path::PathBuf;
use std::{ffi::OsStr, path::PathBuf};
// check is dir function by passing in arbitrary strings
#[quickcheck]

View File

@ -1,8 +1,7 @@
mod extract;
mod file_move;
use std::fs;
use std::path::Path;
use std::{fs, path::Path};
pub use extract::*;
pub use file_move::*;

View File

@ -1,8 +1,6 @@
use either::{self, Either};
use std::fs;
use std::io;
use std::path;
use std::{fs, io, path};
/// The supported archive formats.
#[derive(Debug, Clone, Copy, PartialEq)]

View File

@ -1,5 +1,4 @@
use std::fs;
use std::path;
use std::{fs, path};
/// Moves a file from the given path to the specified destination.
///

View File

@ -3,9 +3,7 @@ use http::header::HeaderName;
use serde::Deserialize;
use serde_json::Value;
use serde_repr::{Deserialize_repr, Serialize_repr};
use std::collections::HashMap;
use std::fs::File;
use std::time::Duration;
use std::{collections::HashMap, fs::File, time::Duration};
#[derive(Serialize_repr, Deserialize_repr, Clone, Debug)]
#[repr(u16)]

View File

@ -1,7 +1,6 @@
use proc_macro2::{Ident, TokenStream};
use quote::quote;
use std::io::Error as IoError;
use std::path::PathBuf;
use std::{io::Error as IoError, path::PathBuf};
use Error::*;
pub(crate) enum Error {

View File

@ -1,13 +1,13 @@
use crate::error::Error;
use crate::include_dir::IncludeDir;
use crate::DEFAULT_CONFIG_FILE;
use crate::{error::Error, include_dir::IncludeDir, DEFAULT_CONFIG_FILE};
use proc_macro2::TokenStream;
use quote::quote;
use std::collections::HashSet;
use std::env::var;
use std::fs::File;
use std::io::BufReader;
use std::path::{Path, PathBuf};
use std::{
collections::HashSet,
env::var,
fs::File,
io::BufReader,
path::{Path, PathBuf},
};
use syn::{DeriveInput, Lit::Str, Meta::NameValue, MetaNameValue};
use tauri_utils::{assets::AssetCompression, config::Config};

View File

@ -1,13 +1,14 @@
use crate::error::Error;
use flate2::bufread::GzEncoder;
use proc_macro2::TokenStream;
use quote::quote;
use quote::TokenStreamExt;
use std::collections::{HashMap, HashSet};
use std::env::var;
use std::fs::{canonicalize, create_dir_all, File};
use std::io::{BufReader, BufWriter};
use std::path::{Path, PathBuf};
use quote::{quote, TokenStreamExt};
use std::{
collections::{HashMap, HashSet},
env::var,
fs::{canonicalize, create_dir_all, File},
io::{BufReader, BufWriter},
path::{Path, PathBuf},
};
use tauri_utils::assets::{AssetCompression, Assets};
use walkdir::WalkDir;

View File

@ -2,8 +2,10 @@
use flate2::read::{GzDecoder, GzEncoder};
pub use phf;
use std::io::Read;
use std::path::{Component, Path, PathBuf};
use std::{
io::Read,
path::{Component, Path, PathBuf},
};
/// Type of compression applied to an asset
#[derive(Debug, Copy, Clone, PartialEq, Eq)]

View File

@ -1,5 +1,7 @@
use serde::de::{Deserializer, Error as DeError, Visitor};
use serde::Deserialize;
use serde::{
de::{Deserializer, Error as DeError, Visitor},
Deserialize,
};
use serde_json::Value as JsonValue;
use std::collections::HashMap;

View File

@ -11,3 +11,4 @@ merge_derives = true
use_try_shorthand = false
use_field_init_shorthand = false
force_explicit_abi = true
imports_granularity = "Crate"

View File

@ -11,3 +11,4 @@ merge_derives = true
use_try_shorthand = false
use_field_init_shorthand = false
force_explicit_abi = true
imports_granularity = "Crate"

View File

@ -1,8 +1,7 @@
use crate::ApplicationExt;
use futures::future::BoxFuture;
use std::marker::PhantomData;
use tauri_api::config::Config;
use tauri_api::private::AsTauriContext;
use tauri_api::{config::Config, private::AsTauriContext};
mod runner;

View File

@ -394,8 +394,7 @@ fn get_api_error_message(arg: &str, handler_error_message: String) -> String {
#[cfg(test)]
mod test {
use super::Content;
use crate::Context;
use crate::FromTauriContext;
use crate::{Context, FromTauriContext};
use proptest::prelude::*;
#[cfg(dev)]
use std::io::Read;

View File

@ -1,9 +1,11 @@
use super::cmd::{OpenDialogOptions, SaveDialogOptions};
use crate::api::dialog::{
ask as ask_dialog, message as message_dialog, pick_folder, save_file, select, select_multiple,
DialogSelection, Response,
use crate::{
api::dialog::{
ask as ask_dialog, message as message_dialog, pick_folder, save_file, select, select_multiple,
DialogSelection, Response,
},
ApplicationDispatcherExt,
};
use crate::ApplicationDispatcherExt;
use serde_json::Value as JsonValue;
/// maps a dialog response to a JS value to eval

View File

@ -1,13 +1,8 @@
use crate::ApplicationDispatcherExt;
use tauri_api::dir;
use tauri_api::file;
use tauri_api::path::resolve_path;
use tauri_api::{dir, file, path::resolve_path};
use std::fs;
use std::fs::File;
use std::io::Write;
use std::path::PathBuf;
use std::{fs, fs::File, io::Write, path::PathBuf};
use super::cmd::{DirOperationOptions, FileOperationOptions};

View File

@ -1,8 +1,7 @@
use super::cmd::NotificationOptions;
use crate::ApplicationDispatcherExt;
use serde_json::Value as JsonValue;
use tauri_api::config::Config;
use tauri_api::notification::Notification;
use tauri_api::{config::Config, notification::Notification};
pub async fn send<D: ApplicationDispatcherExt>(
dispatcher: &mut D,

View File

@ -1,7 +1,6 @@
#![cfg(path_api)]
use crate::ApplicationDispatcherExt;
use tauri_api::path;
use tauri_api::path::BaseDirectory;
use tauri_api::{path, path::BaseDirectory};
pub async fn resolve_path<D: ApplicationDispatcherExt>(
dispatcher: &mut D,

View File

@ -1,6 +1,8 @@
use std::boxed::Box;
use std::collections::HashMap;
use std::sync::{Arc, Mutex};
use std::{
boxed::Box,
collections::HashMap,
sync::{Arc, Mutex},
};
use crate::ApplicationDispatcherExt;
use lazy_static::lazy_static;

View File

@ -1,6 +1,4 @@
use crate::api::config::PluginConfig;
use crate::async_runtime::Mutex;
use crate::ApplicationDispatcherExt;
use crate::{api::config::PluginConfig, async_runtime::Mutex, ApplicationDispatcherExt};
use futures::future::join_all;

View File

@ -1,9 +1,13 @@
use serde::{Deserialize, Serialize};
use std::fs::File;
use std::io::Write;
use std::path::{Path, PathBuf};
use tauri_api::file::read_string;
use tauri_api::path::{resolve_path, BaseDirectory};
use std::{
fs::File,
io::Write,
path::{Path, PathBuf},
};
use tauri_api::{
file::read_string,
path::{resolve_path, BaseDirectory},
};
/// Tauri Settings.
#[derive(Default, Deserialize, Serialize)]