From b258604fd05b5517db0f1da1068b7cd1e5e41c44 Mon Sep 17 00:00:00 2001 From: Bruce Leidl Date: Thu, 17 Jan 2019 09:25:24 -0500 Subject: [PATCH] Updated everything for Rust 2018 with cargo fix --edition --- citadel-desktopd/Cargo.toml | 1 + citadel-desktopd/src/config.rs | 2 +- citadel-desktopd/src/desktop.rs | 2 +- citadel-desktopd/src/desktop_file_sync.rs | 8 ++++---- citadel-desktopd/src/main.rs | 4 ++-- citadel-desktopd/src/monitor.rs | 2 +- citadel-desktopd/src/parser.rs | 4 ++-- citadel-image/src/build.rs | 2 +- citadel-image/src/main.rs | 4 ++-- citadel-install/Cargo.toml | 1 + citadel-install/src/cli.rs | 6 +++--- citadel-install/src/disks.rs | 4 ++-- citadel-realms/Cargo.toml | 1 + citadel-realms/src/appimg.rs | 4 ++-- citadel-realms/src/config.rs | 2 +- citadel-realms/src/main.rs | 14 +++++++------- citadel-realms/src/manager.rs | 12 ++++++------ citadel-realms/src/network.rs | 2 +- citadel-realms/src/realm.rs | 6 +++--- citadel-realms/src/systemd.rs | 8 ++++---- citadel-realms/src/util.rs | 2 +- libcitadel/Cargo.toml | 1 + libcitadel/src/blockdev.rs | 2 +- libcitadel/src/cmdline.rs | 2 +- libcitadel/src/config.rs | 2 +- libcitadel/src/header.rs | 4 ++-- libcitadel/src/keys.rs | 2 +- libcitadel/src/lib.rs | 16 ++++++++-------- libcitadel/src/mount.rs | 2 +- libcitadel/src/partition.rs | 2 +- libcitadel/src/resource.rs | 2 +- libcitadel/src/util.rs | 2 +- libcitadel/src/verity.rs | 2 +- 33 files changed, 67 insertions(+), 63 deletions(-) diff --git a/citadel-desktopd/Cargo.toml b/citadel-desktopd/Cargo.toml index 6f5bc62..0c3eaf8 100644 --- a/citadel-desktopd/Cargo.toml +++ b/citadel-desktopd/Cargo.toml @@ -3,6 +3,7 @@ name = "citadel-desktopd" version = "0.1.0" authors = ["brl@subgraph.com"] homepage = "https://github.com/subgraph/citadel" +edition = "2018" [dependencies] failure = "0.1.1" diff --git a/citadel-desktopd/src/config.rs b/citadel-desktopd/src/config.rs index 5760e9d..bf668c4 100644 --- a/citadel-desktopd/src/config.rs +++ b/citadel-desktopd/src/config.rs @@ -1,7 +1,7 @@ use std::path::{Path,PathBuf}; use std::fs::File; use std::io::Read; -use Result; +use crate::Result; use toml; #[derive(Clone)] diff --git a/citadel-desktopd/src/desktop.rs b/citadel-desktopd/src/desktop.rs index 542c6a5..96a8ffa 100644 --- a/citadel-desktopd/src/desktop.rs +++ b/citadel-desktopd/src/desktop.rs @@ -2,7 +2,7 @@ use std::io::Write; use std::fs::File; use std::path::Path; use std::collections::HashMap; -use Result; +use crate::Result; pub struct DesktopFile { diff --git a/citadel-desktopd/src/desktop_file_sync.rs b/citadel-desktopd/src/desktop_file_sync.rs index 573f623..a12185e 100644 --- a/citadel-desktopd/src/desktop_file_sync.rs +++ b/citadel-desktopd/src/desktop_file_sync.rs @@ -4,10 +4,10 @@ use std::fs; use failure::ResultExt; -use monitor::{DirectoryMonitor,MonitorEventHandler}; -use parser::DesktopFileParser; -use config::Config; -use Result; +use crate::monitor::{DirectoryMonitor,MonitorEventHandler}; +use crate::parser::DesktopFileParser; +use crate::config::Config; +use crate::Result; pub struct DesktopFileSync { diff --git a/citadel-desktopd/src/main.rs b/citadel-desktopd/src/main.rs index 8f4c252..031d2bd 100644 --- a/citadel-desktopd/src/main.rs +++ b/citadel-desktopd/src/main.rs @@ -17,9 +17,9 @@ mod desktop_file_sync; use std::result; use std::process; use failure::Error; -use desktop_file_sync::DesktopFileSync; +use crate::desktop_file_sync::DesktopFileSync; -use config::Config; +use crate::config::Config; pub type Result = result::Result; diff --git a/citadel-desktopd/src/monitor.rs b/citadel-desktopd/src/monitor.rs index d71641f..8726932 100644 --- a/citadel-desktopd/src/monitor.rs +++ b/citadel-desktopd/src/monitor.rs @@ -11,7 +11,7 @@ use nix::sys::signal; use inotify::{Events,Inotify,EventMask,WatchMask,Event,WatchDescriptor}; -use Result; +use crate::Result; pub trait MonitorEventHandler: Send+Sync { fn file_added(&self, path: &Path) -> Result<()> { let _ = path; Ok(()) } diff --git a/citadel-desktopd/src/parser.rs b/citadel-desktopd/src/parser.rs index d8f8633..ba0f27f 100644 --- a/citadel-desktopd/src/parser.rs +++ b/citadel-desktopd/src/parser.rs @@ -3,8 +3,8 @@ use std::io::Read; use std::fs::File; use std::path::Path; use std::collections::HashSet; -use desktop::{DesktopFile,Line}; -use Result; +use crate::desktop::{DesktopFile,Line}; +use crate::Result; lazy_static! { // These are the keys which are copied into the translated .desktop files diff --git a/citadel-image/src/build.rs b/citadel-image/src/build.rs index 8a2d0f9..43d942e 100644 --- a/citadel-image/src/build.rs +++ b/citadel-image/src/build.rs @@ -6,7 +6,7 @@ use std::io::{self,Write}; use failure::ResultExt; use libcitadel::{Result,ImageHeader,verity,util,devkeys}; -use BuildConfig; +use crate::BuildConfig; pub struct UpdateBuilder { config: BuildConfig, diff --git a/citadel-image/src/main.rs b/citadel-image/src/main.rs index 5534eca..993a6d0 100644 --- a/citadel-image/src/main.rs +++ b/citadel-image/src/main.rs @@ -11,8 +11,8 @@ use std::path::Path; use clap::{App,Arg,SubCommand,ArgMatches}; use clap::AppSettings::*; -use build::UpdateBuilder; -use config::BuildConfig; +use crate::build::UpdateBuilder; +use crate::config::BuildConfig; use libcitadel::{Result,ResourceImage,set_verbose,format_error,Partition,KeyPair,ImageHeader}; mod build; diff --git a/citadel-install/Cargo.toml b/citadel-install/Cargo.toml index 3f4e32e..48fb04f 100644 --- a/citadel-install/Cargo.toml +++ b/citadel-install/Cargo.toml @@ -3,6 +3,7 @@ name = "citadel-install" version = "0.1.0" authors = ["Bruce Leidl "] homepage = "http://github.com/subgraph/citadel" +edition = "2018" [dependencies] libcitadel = { path = "../libcitadel" } diff --git a/citadel-install/src/cli.rs b/citadel-install/src/cli.rs index c8c6859..5459f29 100644 --- a/citadel-install/src/cli.rs +++ b/citadel-install/src/cli.rs @@ -1,9 +1,9 @@ use std::io::{self,Write}; use std::path::Path; -use Result; -use util::Disk; +use crate::Result; +use crate::util::Disk; use rpassword; -use installer::Installer; +use crate::installer::Installer; pub fn run_cli_install() -> Result { let disk = match choose_disk()? { diff --git a/citadel-install/src/disks.rs b/citadel-install/src/disks.rs index e707514..8fe1008 100644 --- a/citadel-install/src/disks.rs +++ b/citadel-install/src/disks.rs @@ -1,8 +1,8 @@ use std::path::{Path, PathBuf}; use std::fs; -use Result; -use util; +use crate::Result; +use crate::util; /// /// Represents a disk partition device on the system diff --git a/citadel-realms/Cargo.toml b/citadel-realms/Cargo.toml index 2dd374c..d60d036 100644 --- a/citadel-realms/Cargo.toml +++ b/citadel-realms/Cargo.toml @@ -3,6 +3,7 @@ name = "citadel-realms" version = "0.1.0" authors = ["Bruce Leidl "] homepage = "http://github.com/subgraph/citadel" +edition = "2018" [dependencies] libc = "0.2" diff --git a/citadel-realms/src/appimg.rs b/citadel-realms/src/appimg.rs index 0a93e1a..1519eb3 100644 --- a/citadel-realms/src/appimg.rs +++ b/citadel-realms/src/appimg.rs @@ -1,8 +1,8 @@ use std::path::Path; use std::process::Command; -use Realm; -use Result; +use crate::Realm; +use crate::Result; const BASE_APPIMG_PATH: &str = "/storage/appimg/base.appimg"; const BTRFS_COMMAND: &str = "/usr/bin/btrfs"; diff --git a/citadel-realms/src/config.rs b/citadel-realms/src/config.rs index 6bcffff..da7bc2b 100644 --- a/citadel-realms/src/config.rs +++ b/citadel-realms/src/config.rs @@ -2,7 +2,7 @@ use std::path::Path; use std::fs::File; use std::io::Read; use toml; -use Result; +use crate::Result; fn default_true() -> bool { true diff --git a/citadel-realms/src/main.rs b/citadel-realms/src/main.rs index a72bdb5..97d7242 100644 --- a/citadel-realms/src/main.rs +++ b/citadel-realms/src/main.rs @@ -29,8 +29,8 @@ macro_rules! warn { } macro_rules! info { - ($e:expr) => { if ::verbose() { println!("[+]: {}", $e); } }; - ($fmt:expr, $($arg:tt)+) => { if ::verbose() { println!("[+]: {}", format!($fmt, $($arg)+)); } }; + ($e:expr) => { if crate::verbose() { println!("[+]: {}", $e); } }; + ($fmt:expr, $($arg:tt)+) => { if crate::verbose() { println!("[+]: {}", format!($fmt, $($arg)+)); } }; } mod manager; @@ -41,11 +41,11 @@ mod config; mod network; mod appimg; -use realm::{Realm,RealmSymlinks}; -use manager::RealmManager; -use config::RealmConfig; -use systemd::Systemd; -use network::NetworkConfig; +use crate::realm::{Realm,RealmSymlinks}; +use crate::manager::RealmManager; +use crate::config::RealmConfig; +use crate::systemd::Systemd; +use crate::network::NetworkConfig; fn main() { let app = App::new("citadel-realms") diff --git a/citadel-realms/src/manager.rs b/citadel-realms/src/manager.rs index 867f074..c512aee 100644 --- a/citadel-realms/src/manager.rs +++ b/citadel-realms/src/manager.rs @@ -6,12 +6,12 @@ use std::collections::HashMap; use std::io::Write; -use Realm; -use Result; -use Systemd; -use RealmSymlinks; -use NetworkConfig; -use util::*; +use crate::Realm; +use crate::Result; +use crate::Systemd; +use crate::RealmSymlinks; +use crate::NetworkConfig; +use crate::util::*; const REALMS_BASE_PATH: &str = "/realms"; diff --git a/citadel-realms/src/network.rs b/citadel-realms/src/network.rs index ab8a35c..48218da 100644 --- a/citadel-realms/src/network.rs +++ b/citadel-realms/src/network.rs @@ -4,7 +4,7 @@ use std::collections::{HashSet,HashMap}; use std::io::{BufReader,BufRead,Write}; use std::fs::{self,File}; -use Result; +use crate::Result; const MIN_MASK: usize = 16; const MAX_MASK: usize = 24; diff --git a/citadel-realms/src/realm.rs b/citadel-realms/src/realm.rs index 28cea1e..d9b79d6 100644 --- a/citadel-realms/src/realm.rs +++ b/citadel-realms/src/realm.rs @@ -5,9 +5,9 @@ use std::cell::{RefCell,Cell}; use std::fs::{self,File}; use std::os::unix::fs::{symlink,MetadataExt}; -use {RealmConfig,Result,Systemd,NetworkConfig}; -use util::*; -use appimg::*; +use crate::{RealmConfig,Result,Systemd,NetworkConfig}; +use crate::util::*; +use crate::appimg::*; const REALMS_BASE_PATH: &str = "/realms"; const REALMS_RUN_PATH: &str = "/run/realms"; diff --git a/citadel-realms/src/systemd.rs b/citadel-realms/src/systemd.rs index 0dcf999..84adf6d 100644 --- a/citadel-realms/src/systemd.rs +++ b/citadel-realms/src/systemd.rs @@ -14,10 +14,10 @@ const SYSTEMD_UNIT_PATH: &str = "/run/systemd/system"; const DESKTOPD_SERVICE: &str = "citadel-desktopd.service"; -use Realm; -use NetworkConfig; -use Result; -use util::{path_filename,is_first_char_alphabetic}; +use crate::Realm; +use crate::NetworkConfig; +use crate::Result; +use crate::util::{path_filename,is_first_char_alphabetic}; #[derive(Clone)] pub struct Systemd { diff --git a/citadel-realms/src/util.rs b/citadel-realms/src/util.rs index 6b34c3a..fb17d7b 100644 --- a/citadel-realms/src/util.rs +++ b/citadel-realms/src/util.rs @@ -8,7 +8,7 @@ use std::io::{self,Write}; use libc; use walkdir::WalkDir; -use Result; +use crate::Result; pub fn path_filename(path: &Path) -> &str { diff --git a/libcitadel/Cargo.toml b/libcitadel/Cargo.toml index a84d273..ee3bb23 100644 --- a/libcitadel/Cargo.toml +++ b/libcitadel/Cargo.toml @@ -2,6 +2,7 @@ name = "libcitadel" version = "0.1.0" authors = ["Bruce Leidl "] +edition = "2018" [dependencies] libc = "0.2" diff --git a/libcitadel/src/blockdev.rs b/libcitadel/src/blockdev.rs index 29a2df1..300cd84 100644 --- a/libcitadel/src/blockdev.rs +++ b/libcitadel/src/blockdev.rs @@ -6,7 +6,7 @@ use std::fs::OpenOptions; use std::os::unix::fs::OpenOptionsExt; use libc; -use Result; +use crate::Result; // IO on block devices requires 4096 byte aligned buffer const REQUIRED_ALIGNMENT: usize = 4096; diff --git a/libcitadel/src/cmdline.rs b/libcitadel/src/cmdline.rs index fe3d786..594bd74 100644 --- a/libcitadel/src/cmdline.rs +++ b/libcitadel/src/cmdline.rs @@ -1,7 +1,7 @@ use std::collections::HashMap; use std::fs; -use Result; +use crate::Result; lazy_static! { static ref CMDLINE: CommandLine = match CommandLine::load() { diff --git a/libcitadel/src/config.rs b/libcitadel/src/config.rs index c5cfd68..0e08fab 100644 --- a/libcitadel/src/config.rs +++ b/libcitadel/src/config.rs @@ -2,7 +2,7 @@ use std::path::Path; use std::collections::HashMap; use std::fs; -use Result; +use crate::Result; lazy_static! { static ref OS_RELEASE: Option = match OsRelease::load() { diff --git a/libcitadel/src/header.rs b/libcitadel/src/header.rs index 9354d8b..3e5aaac 100644 --- a/libcitadel/src/header.rs +++ b/libcitadel/src/header.rs @@ -7,8 +7,8 @@ use failure::ResultExt; use toml; -use blockdev::AlignedBuffer; -use {BlockDev,Result,public_key_for_channel,PublicKey}; +use crate::blockdev::AlignedBuffer; +use crate::{BlockDev,Result,public_key_for_channel,PublicKey}; /// Expected magic value in header const MAGIC: &[u8] = b"SGOS"; diff --git a/libcitadel/src/keys.rs b/libcitadel/src/keys.rs index 3914691..c8de85b 100644 --- a/libcitadel/src/keys.rs +++ b/libcitadel/src/keys.rs @@ -1,4 +1,4 @@ -use Result; +use crate::Result; use ring::rand; use ring::signature::{self,Ed25519KeyPair,ED25519_PUBLIC_KEY_LEN,ED25519_PKCS8_V2_LEN}; use untrusted::Input; diff --git a/libcitadel/src/lib.rs b/libcitadel/src/lib.rs index c341f4c..3c37ad0 100644 --- a/libcitadel/src/lib.rs +++ b/libcitadel/src/lib.rs @@ -66,14 +66,14 @@ pub mod util; pub mod verity; mod mount; -pub use config::OsRelease; -pub use blockdev::BlockDev; -pub use cmdline::CommandLine; -pub use header::{ImageHeader,MetaInfo}; -pub use partition::Partition; -pub use resource::ResourceImage; -pub use keys::{KeyPair,PublicKey}; -pub use mount::Mount; +pub use crate::config::OsRelease; +pub use crate::blockdev::BlockDev; +pub use crate::cmdline::CommandLine; +pub use crate::header::{ImageHeader,MetaInfo}; +pub use crate::partition::Partition; +pub use crate::resource::ResourceImage; +pub use crate::keys::{KeyPair,PublicKey}; +pub use crate::mount::Mount; const DEVKEYS_HEX: &str = "3053020101300506032b6570042204206ed2849c6c5168e1aebc50005ac3d4a4e84af4889e4e0189bb4c787e6ee0be49a1230321006b652764c62a1de35e7e37af2b743e9a5b82cee2211cf3091d2514441b417f5f"; diff --git a/libcitadel/src/mount.rs b/libcitadel/src/mount.rs index d9defc5..8122d50 100644 --- a/libcitadel/src/mount.rs +++ b/libcitadel/src/mount.rs @@ -1,7 +1,7 @@ use std::path::{PathBuf,Path}; use std::fs; -use Result; +use crate::Result; pub struct Mount { source: String, diff --git a/libcitadel/src/partition.rs b/libcitadel/src/partition.rs index c7d5b61..3b7e306 100644 --- a/libcitadel/src/partition.rs +++ b/libcitadel/src/partition.rs @@ -1,6 +1,6 @@ use std::path::{Path,PathBuf}; use std::fs; -use {Result,ImageHeader,MetaInfo,Mount,PublicKey,public_key_for_channel}; +use crate::{Result,ImageHeader,MetaInfo,Mount,PublicKey,public_key_for_channel}; #[derive(Clone)] pub struct Partition { diff --git a/libcitadel/src/resource.rs b/libcitadel/src/resource.rs index 9467ed1..44d0505 100644 --- a/libcitadel/src/resource.rs +++ b/libcitadel/src/resource.rs @@ -3,7 +3,7 @@ use std::ffi::OsStr; use std::io::{self,Seek,SeekFrom}; use std::path::{Path, PathBuf}; -use {CommandLine,OsRelease,ImageHeader,MetaInfo,Result,Partition,Mount,verity,util}; +use crate::{CommandLine,OsRelease,ImageHeader,MetaInfo,Result,Partition,Mount,verity,util}; use failure::ResultExt; diff --git a/libcitadel/src/util.rs b/libcitadel/src/util.rs index c830f0b..6f2c446 100644 --- a/libcitadel/src/util.rs +++ b/libcitadel/src/util.rs @@ -8,7 +8,7 @@ use std::env; use failure::ResultExt; -use Result; +use crate::Result; fn search_path(filename: &str) -> Result { let path_var = env::var("PATH")?; diff --git a/libcitadel/src/verity.rs b/libcitadel/src/verity.rs index d9c6aaf..8266f63 100644 --- a/libcitadel/src/verity.rs +++ b/libcitadel/src/verity.rs @@ -3,7 +3,7 @@ use std::collections::HashMap; use std::process::{Command, Stdio}; use failure::ResultExt; -use {Result,ImageHeader,MetaInfo,Partition,util}; +use crate::{Result,ImageHeader,MetaInfo,Partition,util}; const VERITYSETUP: &str = "/sbin/veritysetup"; const LOSETUP: &str = "/sbin/losetup";