From 5ff1486f695a6640e697a912dc3849c04b162e72 Mon Sep 17 00:00:00 2001 From: liushuyu Date: Mon, 9 Mar 2020 00:39:24 -0600 Subject: [PATCH] meta: update to Rust 2018 standard --- Cargo.toml | 1 + src/config.rs | 4 +-- src/frontend/mod.rs | 4 +-- src/frontend/rest/assets.rs | 2 +- src/frontend/rest/server.rs | 6 ++-- src/frontend/rest/services/attributes.rs | 18 ++++++------ src/frontend/rest/services/config.rs | 14 +++++----- src/frontend/rest/services/dark_mode.rs | 14 +++++----- src/frontend/rest/services/default_path.rs | 12 ++++---- src/frontend/rest/services/exit.rs | 10 +++---- src/frontend/rest/services/install.rs | 12 ++++---- .../rest/services/installation_status.rs | 12 ++++---- src/frontend/rest/services/mod.rs | 4 +-- src/frontend/rest/services/packages.rs | 14 +++++----- src/frontend/rest/services/static_files.rs | 14 +++++----- src/frontend/rest/services/uninstall.rs | 14 +++++----- src/frontend/rest/services/update_updater.rs | 14 +++++----- src/frontend/ui/mod.rs | 2 +- src/installer.rs | 22 +++++++-------- src/native/mod.rs | 4 +-- src/self_update.rs | 2 +- src/sources/github/mod.rs | 4 +-- src/tasks/download_pkg.rs | 18 ++++++------ src/tasks/ensure_only_instance.rs | 14 +++++----- src/tasks/install.rs | 24 ++++++++-------- src/tasks/install_dir.rs | 12 ++++---- src/tasks/install_global_shortcut.rs | 18 ++++++------ src/tasks/install_pkg.rs | 28 +++++++++---------- src/tasks/install_shortcuts.rs | 16 +++++------ src/tasks/mod.rs | 6 ++-- src/tasks/resolver.rs | 14 +++++----- src/tasks/save_database.rs | 10 +++---- src/tasks/save_executable.rs | 12 ++++---- src/tasks/uninstall.rs | 14 +++++----- src/tasks/uninstall_global_shortcut.rs | 14 +++++----- src/tasks/uninstall_pkg.rs | 20 ++++++------- src/tasks/uninstall_shortcuts.rs | 14 +++++----- 37 files changed, 219 insertions(+), 218 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 69e55cc..6a85e2f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,7 @@ [package] name = "liftinstall" version = "0.2.0" +edition = "2018" authors = ["James "] repository = "https://github.com/j-selby/liftinstall.git" documentation = "https://liftinstall.jselby.net" diff --git a/src/config.rs b/src/config.rs index e5ac346..94123c7 100644 --- a/src/config.rs +++ b/src/config.rs @@ -7,8 +7,8 @@ use toml::de::Error as TomlError; use serde_json::{self, Error as SerdeError}; -use sources::get_by_name; -use sources::types::Release; +use crate::sources::get_by_name; +use crate::sources::types::Release; /// Description of the source of a package. #[derive(Debug, Deserialize, Serialize, Clone)] diff --git a/src/frontend/mod.rs b/src/frontend/mod.rs index a09c49f..056035d 100644 --- a/src/frontend/mod.rs +++ b/src/frontend/mod.rs @@ -4,8 +4,8 @@ use std::sync::{Arc, RwLock}; -use installer::InstallerFramework; -use logging::LoggingErrors; +use crate::installer::InstallerFramework; +use crate::logging::LoggingErrors; pub mod rest; mod ui; diff --git a/src/frontend/rest/assets.rs b/src/frontend/rest/assets.rs index 66090c3..0b5d988 100644 --- a/src/frontend/rest/assets.rs +++ b/src/frontend/rest/assets.rs @@ -2,8 +2,8 @@ extern crate mime_guess; -use self::mime_guess::mime::APPLICATION_OCTET_STREAM; use self::mime_guess::from_ext; +use self::mime_guess::mime::APPLICATION_OCTET_STREAM; macro_rules! include_files_as_assets { ( $target_match:expr, $( $file_name:expr ),* ) => { diff --git a/src/frontend/rest/server.rs b/src/frontend/rest/server.rs index e970763..cd27400 100644 --- a/src/frontend/rest/server.rs +++ b/src/frontend/rest/server.rs @@ -2,11 +2,11 @@ //! //! Contains the over-arching server object + methods to manipulate it. -use frontend::rest::services::WebService; +use crate::frontend::rest::services::WebService; -use installer::InstallerFramework; +use crate::installer::InstallerFramework; -use logging::LoggingErrors; +use crate::logging::LoggingErrors; use hyper::server::Http; diff --git a/src/frontend/rest/services/attributes.rs b/src/frontend/rest/services/attributes.rs index 0ef61d9..4b48a6d 100644 --- a/src/frontend/rest/services/attributes.rs +++ b/src/frontend/rest/services/attributes.rs @@ -2,23 +2,23 @@ //! //! The /api/attr call returns an executable script containing session variables. -use frontend::rest::services::default_future; -use frontend::rest::services::Future; -use frontend::rest::services::Request; -use frontend::rest::services::Response; -use frontend::rest::services::WebService; +use crate::frontend::rest::services::default_future; +use crate::frontend::rest::services::Future; +use crate::frontend::rest::services::Request; +use crate::frontend::rest::services::Response; +use crate::frontend::rest::services::WebService; use hyper::header::{ContentLength, ContentType}; -use logging::LoggingErrors; +use crate::logging::LoggingErrors; pub fn handle(service: &WebService, _req: Request) -> Future { let framework = service.get_framework_read(); let file = framework - .base_attributes - .to_json_str() - .log_expect("Failed to render JSON representation of config"); + .base_attributes + .to_json_str() + .log_expect("Failed to render JSON representation of config"); default_future( Response::new() diff --git a/src/frontend/rest/services/config.rs b/src/frontend/rest/services/config.rs index e742493..550a5d3 100644 --- a/src/frontend/rest/services/config.rs +++ b/src/frontend/rest/services/config.rs @@ -4,18 +4,18 @@ //! //! This endpoint should be usable directly from a