Updated everything for Rust 2018 with cargo fix --edition

This commit is contained in:
Bruce Leidl 2019-01-17 09:25:24 -05:00
parent 928e8cc41c
commit b258604fd0
33 changed files with 67 additions and 63 deletions

View File

@ -3,6 +3,7 @@ name = "citadel-desktopd"
version = "0.1.0" version = "0.1.0"
authors = ["brl@subgraph.com"] authors = ["brl@subgraph.com"]
homepage = "https://github.com/subgraph/citadel" homepage = "https://github.com/subgraph/citadel"
edition = "2018"
[dependencies] [dependencies]
failure = "0.1.1" failure = "0.1.1"

View File

@ -1,7 +1,7 @@
use std::path::{Path,PathBuf}; use std::path::{Path,PathBuf};
use std::fs::File; use std::fs::File;
use std::io::Read; use std::io::Read;
use Result; use crate::Result;
use toml; use toml;
#[derive(Clone)] #[derive(Clone)]

View File

@ -2,7 +2,7 @@ use std::io::Write;
use std::fs::File; use std::fs::File;
use std::path::Path; use std::path::Path;
use std::collections::HashMap; use std::collections::HashMap;
use Result; use crate::Result;
pub struct DesktopFile { pub struct DesktopFile {

View File

@ -4,10 +4,10 @@ use std::fs;
use failure::ResultExt; use failure::ResultExt;
use monitor::{DirectoryMonitor,MonitorEventHandler}; use crate::monitor::{DirectoryMonitor,MonitorEventHandler};
use parser::DesktopFileParser; use crate::parser::DesktopFileParser;
use config::Config; use crate::config::Config;
use Result; use crate::Result;
pub struct DesktopFileSync { pub struct DesktopFileSync {

View File

@ -17,9 +17,9 @@ mod desktop_file_sync;
use std::result; use std::result;
use std::process; use std::process;
use failure::Error; use failure::Error;
use desktop_file_sync::DesktopFileSync; use crate::desktop_file_sync::DesktopFileSync;
use config::Config; use crate::config::Config;
pub type Result<T> = result::Result<T, Error>; pub type Result<T> = result::Result<T, Error>;

View File

@ -11,7 +11,7 @@ use nix::sys::signal;
use inotify::{Events,Inotify,EventMask,WatchMask,Event,WatchDescriptor}; use inotify::{Events,Inotify,EventMask,WatchMask,Event,WatchDescriptor};
use Result; use crate::Result;
pub trait MonitorEventHandler: Send+Sync { pub trait MonitorEventHandler: Send+Sync {
fn file_added(&self, path: &Path) -> Result<()> { let _ = path; Ok(()) } fn file_added(&self, path: &Path) -> Result<()> { let _ = path; Ok(()) }

View File

@ -3,8 +3,8 @@ use std::io::Read;
use std::fs::File; use std::fs::File;
use std::path::Path; use std::path::Path;
use std::collections::HashSet; use std::collections::HashSet;
use desktop::{DesktopFile,Line}; use crate::desktop::{DesktopFile,Line};
use Result; use crate::Result;
lazy_static! { lazy_static! {
// These are the keys which are copied into the translated .desktop files // These are the keys which are copied into the translated .desktop files

View File

@ -6,7 +6,7 @@ use std::io::{self,Write};
use failure::ResultExt; use failure::ResultExt;
use libcitadel::{Result,ImageHeader,verity,util,devkeys}; use libcitadel::{Result,ImageHeader,verity,util,devkeys};
use BuildConfig; use crate::BuildConfig;
pub struct UpdateBuilder { pub struct UpdateBuilder {
config: BuildConfig, config: BuildConfig,

View File

@ -11,8 +11,8 @@ use std::path::Path;
use clap::{App,Arg,SubCommand,ArgMatches}; use clap::{App,Arg,SubCommand,ArgMatches};
use clap::AppSettings::*; use clap::AppSettings::*;
use build::UpdateBuilder; use crate::build::UpdateBuilder;
use config::BuildConfig; use crate::config::BuildConfig;
use libcitadel::{Result,ResourceImage,set_verbose,format_error,Partition,KeyPair,ImageHeader}; use libcitadel::{Result,ResourceImage,set_verbose,format_error,Partition,KeyPair,ImageHeader};
mod build; mod build;

View File

@ -3,6 +3,7 @@ name = "citadel-install"
version = "0.1.0" version = "0.1.0"
authors = ["Bruce Leidl <bruce@subgraph.com>"] authors = ["Bruce Leidl <bruce@subgraph.com>"]
homepage = "http://github.com/subgraph/citadel" homepage = "http://github.com/subgraph/citadel"
edition = "2018"
[dependencies] [dependencies]
libcitadel = { path = "../libcitadel" } libcitadel = { path = "../libcitadel" }

View File

@ -1,9 +1,9 @@
use std::io::{self,Write}; use std::io::{self,Write};
use std::path::Path; use std::path::Path;
use Result; use crate::Result;
use util::Disk; use crate::util::Disk;
use rpassword; use rpassword;
use installer::Installer; use crate::installer::Installer;
pub fn run_cli_install() -> Result<bool> { pub fn run_cli_install() -> Result<bool> {
let disk = match choose_disk()? { let disk = match choose_disk()? {

View File

@ -1,8 +1,8 @@
use std::path::{Path, PathBuf}; use std::path::{Path, PathBuf};
use std::fs; use std::fs;
use Result; use crate::Result;
use util; use crate::util;
/// ///
/// Represents a disk partition device on the system /// Represents a disk partition device on the system

View File

@ -3,6 +3,7 @@ name = "citadel-realms"
version = "0.1.0" version = "0.1.0"
authors = ["Bruce Leidl <bruce@subgraph.com>"] authors = ["Bruce Leidl <bruce@subgraph.com>"]
homepage = "http://github.com/subgraph/citadel" homepage = "http://github.com/subgraph/citadel"
edition = "2018"
[dependencies] [dependencies]
libc = "0.2" libc = "0.2"

View File

@ -1,8 +1,8 @@
use std::path::Path; use std::path::Path;
use std::process::Command; use std::process::Command;
use Realm; use crate::Realm;
use Result; use crate::Result;
const BASE_APPIMG_PATH: &str = "/storage/appimg/base.appimg"; const BASE_APPIMG_PATH: &str = "/storage/appimg/base.appimg";
const BTRFS_COMMAND: &str = "/usr/bin/btrfs"; const BTRFS_COMMAND: &str = "/usr/bin/btrfs";

View File

@ -2,7 +2,7 @@ use std::path::Path;
use std::fs::File; use std::fs::File;
use std::io::Read; use std::io::Read;
use toml; use toml;
use Result; use crate::Result;
fn default_true() -> bool { fn default_true() -> bool {
true true

View File

@ -29,8 +29,8 @@ macro_rules! warn {
} }
macro_rules! info { macro_rules! info {
($e:expr) => { if ::verbose() { println!("[+]: {}", $e); } }; ($e:expr) => { if crate::verbose() { println!("[+]: {}", $e); } };
($fmt:expr, $($arg:tt)+) => { if ::verbose() { println!("[+]: {}", format!($fmt, $($arg)+)); } }; ($fmt:expr, $($arg:tt)+) => { if crate::verbose() { println!("[+]: {}", format!($fmt, $($arg)+)); } };
} }
mod manager; mod manager;
@ -41,11 +41,11 @@ mod config;
mod network; mod network;
mod appimg; mod appimg;
use realm::{Realm,RealmSymlinks}; use crate::realm::{Realm,RealmSymlinks};
use manager::RealmManager; use crate::manager::RealmManager;
use config::RealmConfig; use crate::config::RealmConfig;
use systemd::Systemd; use crate::systemd::Systemd;
use network::NetworkConfig; use crate::network::NetworkConfig;
fn main() { fn main() {
let app = App::new("citadel-realms") let app = App::new("citadel-realms")

View File

@ -6,12 +6,12 @@ use std::collections::HashMap;
use std::io::Write; use std::io::Write;
use Realm; use crate::Realm;
use Result; use crate::Result;
use Systemd; use crate::Systemd;
use RealmSymlinks; use crate::RealmSymlinks;
use NetworkConfig; use crate::NetworkConfig;
use util::*; use crate::util::*;
const REALMS_BASE_PATH: &str = "/realms"; const REALMS_BASE_PATH: &str = "/realms";

View File

@ -4,7 +4,7 @@ use std::collections::{HashSet,HashMap};
use std::io::{BufReader,BufRead,Write}; use std::io::{BufReader,BufRead,Write};
use std::fs::{self,File}; use std::fs::{self,File};
use Result; use crate::Result;
const MIN_MASK: usize = 16; const MIN_MASK: usize = 16;
const MAX_MASK: usize = 24; const MAX_MASK: usize = 24;

View File

@ -5,9 +5,9 @@ use std::cell::{RefCell,Cell};
use std::fs::{self,File}; use std::fs::{self,File};
use std::os::unix::fs::{symlink,MetadataExt}; use std::os::unix::fs::{symlink,MetadataExt};
use {RealmConfig,Result,Systemd,NetworkConfig}; use crate::{RealmConfig,Result,Systemd,NetworkConfig};
use util::*; use crate::util::*;
use appimg::*; use crate::appimg::*;
const REALMS_BASE_PATH: &str = "/realms"; const REALMS_BASE_PATH: &str = "/realms";
const REALMS_RUN_PATH: &str = "/run/realms"; const REALMS_RUN_PATH: &str = "/run/realms";

View File

@ -14,10 +14,10 @@ const SYSTEMD_UNIT_PATH: &str = "/run/systemd/system";
const DESKTOPD_SERVICE: &str = "citadel-desktopd.service"; const DESKTOPD_SERVICE: &str = "citadel-desktopd.service";
use Realm; use crate::Realm;
use NetworkConfig; use crate::NetworkConfig;
use Result; use crate::Result;
use util::{path_filename,is_first_char_alphabetic}; use crate::util::{path_filename,is_first_char_alphabetic};
#[derive(Clone)] #[derive(Clone)]
pub struct Systemd { pub struct Systemd {

View File

@ -8,7 +8,7 @@ use std::io::{self,Write};
use libc; use libc;
use walkdir::WalkDir; use walkdir::WalkDir;
use Result; use crate::Result;
pub fn path_filename(path: &Path) -> &str { pub fn path_filename(path: &Path) -> &str {

View File

@ -2,6 +2,7 @@
name = "libcitadel" name = "libcitadel"
version = "0.1.0" version = "0.1.0"
authors = ["Bruce Leidl <bruce@subgraph.com>"] authors = ["Bruce Leidl <bruce@subgraph.com>"]
edition = "2018"
[dependencies] [dependencies]
libc = "0.2" libc = "0.2"

View File

@ -6,7 +6,7 @@ use std::fs::OpenOptions;
use std::os::unix::fs::OpenOptionsExt; use std::os::unix::fs::OpenOptionsExt;
use libc; use libc;
use Result; use crate::Result;
// IO on block devices requires 4096 byte aligned buffer // IO on block devices requires 4096 byte aligned buffer
const REQUIRED_ALIGNMENT: usize = 4096; const REQUIRED_ALIGNMENT: usize = 4096;

View File

@ -1,7 +1,7 @@
use std::collections::HashMap; use std::collections::HashMap;
use std::fs; use std::fs;
use Result; use crate::Result;
lazy_static! { lazy_static! {
static ref CMDLINE: CommandLine = match CommandLine::load() { static ref CMDLINE: CommandLine = match CommandLine::load() {

View File

@ -2,7 +2,7 @@ use std::path::Path;
use std::collections::HashMap; use std::collections::HashMap;
use std::fs; use std::fs;
use Result; use crate::Result;
lazy_static! { lazy_static! {
static ref OS_RELEASE: Option<OsRelease> = match OsRelease::load() { static ref OS_RELEASE: Option<OsRelease> = match OsRelease::load() {

View File

@ -7,8 +7,8 @@ use failure::ResultExt;
use toml; use toml;
use blockdev::AlignedBuffer; use crate::blockdev::AlignedBuffer;
use {BlockDev,Result,public_key_for_channel,PublicKey}; use crate::{BlockDev,Result,public_key_for_channel,PublicKey};
/// Expected magic value in header /// Expected magic value in header
const MAGIC: &[u8] = b"SGOS"; const MAGIC: &[u8] = b"SGOS";

View File

@ -1,4 +1,4 @@
use Result; use crate::Result;
use ring::rand; use ring::rand;
use ring::signature::{self,Ed25519KeyPair,ED25519_PUBLIC_KEY_LEN,ED25519_PKCS8_V2_LEN}; use ring::signature::{self,Ed25519KeyPair,ED25519_PUBLIC_KEY_LEN,ED25519_PKCS8_V2_LEN};
use untrusted::Input; use untrusted::Input;

View File

@ -66,14 +66,14 @@ pub mod util;
pub mod verity; pub mod verity;
mod mount; mod mount;
pub use config::OsRelease; pub use crate::config::OsRelease;
pub use blockdev::BlockDev; pub use crate::blockdev::BlockDev;
pub use cmdline::CommandLine; pub use crate::cmdline::CommandLine;
pub use header::{ImageHeader,MetaInfo}; pub use crate::header::{ImageHeader,MetaInfo};
pub use partition::Partition; pub use crate::partition::Partition;
pub use resource::ResourceImage; pub use crate::resource::ResourceImage;
pub use keys::{KeyPair,PublicKey}; pub use crate::keys::{KeyPair,PublicKey};
pub use mount::Mount; pub use crate::mount::Mount;
const DEVKEYS_HEX: &str = const DEVKEYS_HEX: &str =
"3053020101300506032b6570042204206ed2849c6c5168e1aebc50005ac3d4a4e84af4889e4e0189bb4c787e6ee0be49a1230321006b652764c62a1de35e7e37af2b743e9a5b82cee2211cf3091d2514441b417f5f"; "3053020101300506032b6570042204206ed2849c6c5168e1aebc50005ac3d4a4e84af4889e4e0189bb4c787e6ee0be49a1230321006b652764c62a1de35e7e37af2b743e9a5b82cee2211cf3091d2514441b417f5f";

View File

@ -1,7 +1,7 @@
use std::path::{PathBuf,Path}; use std::path::{PathBuf,Path};
use std::fs; use std::fs;
use Result; use crate::Result;
pub struct Mount { pub struct Mount {
source: String, source: String,

View File

@ -1,6 +1,6 @@
use std::path::{Path,PathBuf}; use std::path::{Path,PathBuf};
use std::fs; 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)] #[derive(Clone)]
pub struct Partition { pub struct Partition {

View File

@ -3,7 +3,7 @@ use std::ffi::OsStr;
use std::io::{self,Seek,SeekFrom}; use std::io::{self,Seek,SeekFrom};
use std::path::{Path, PathBuf}; 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; use failure::ResultExt;

View File

@ -8,7 +8,7 @@ use std::env;
use failure::ResultExt; use failure::ResultExt;
use Result; use crate::Result;
fn search_path(filename: &str) -> Result<PathBuf> { fn search_path(filename: &str) -> Result<PathBuf> {
let path_var = env::var("PATH")?; let path_var = env::var("PATH")?;

View File

@ -3,7 +3,7 @@ use std::collections::HashMap;
use std::process::{Command, Stdio}; use std::process::{Command, Stdio};
use failure::ResultExt; use failure::ResultExt;
use {Result,ImageHeader,MetaInfo,Partition,util}; use crate::{Result,ImageHeader,MetaInfo,Partition,util};
const VERITYSETUP: &str = "/sbin/veritysetup"; const VERITYSETUP: &str = "/sbin/veritysetup";
const LOSETUP: &str = "/sbin/losetup"; const LOSETUP: &str = "/sbin/losetup";