diff --git a/src/cli.rs b/src/cli.rs index 42b8d563..3b1d8b4b 100644 --- a/src/cli.rs +++ b/src/cli.rs @@ -1,10 +1,8 @@ +use std::fmt::{Debug, Formatter, Error}; + extern crate clap; use clap::{App, ArgMatches}; -use std::fmt::Debug; -use std::fmt::Formatter; -use std::fmt::Error; - pub struct ModuleConfig { pub load : bool, } diff --git a/src/configuration.rs b/src/configuration.rs index c8eb8e67..8a6d6e31 100644 --- a/src/configuration.rs +++ b/src/configuration.rs @@ -1,14 +1,9 @@ -extern crate clap; - -use cli::CliConfig; - +use std::fmt::{Debug, Formatter, Error}; use std::path::Path; + use config::reader::from_file; use config::types::Config as Cfg; - -use std::fmt::Debug; -use std::fmt::Formatter; -use std::fmt::Error; +use cli::CliConfig; pub struct Configuration { pub rtp : String, diff --git a/src/main.rs b/src/main.rs index ce8e3cdb..9e1f99cf 100644 --- a/src/main.rs +++ b/src/main.rs @@ -11,6 +11,8 @@ extern crate url; extern crate config; +use std::process::exit; + use cli::CliConfig; use configuration::Configuration; use runtime::{ImagLogger, Runtime}; @@ -28,8 +30,6 @@ mod module; mod storage; mod ui; -use std::process::exit; - fn main() { let yaml = load_yaml!("../etc/cli.yml"); let app = App::from_yaml(yaml); diff --git a/src/module/bm/commands.rs b/src/module/bm/commands.rs index ee5630cb..3b7a1d35 100644 --- a/src/module/bm/commands.rs +++ b/src/module/bm/commands.rs @@ -1,22 +1,17 @@ -use runtime::Runtime; -use storage::backend::{StorageBackendError, StorageBackend}; - -use module::Module; -use module::ModuleError; -use module::CommandResult; -use module::CommandEnv; - -use module::bm::header::build_header; -use module::bm::header::get_tags_from_header; -use storage::json::parser::JsonHeaderParser; -use storage::parser::{Parser, FileHeaderParser}; -use storage::file::File; -use ui::file::{FilePrinter, TablePrinter}; use std::vec::IntoIter; use clap::ArgMatches; use regex::Regex; +use module::{CommandEnv, CommandResult, Module, ModuleError}; +use module::bm::header::{build_header, get_tags_from_header}; +use runtime::Runtime; +use storage::backend::{StorageBackendError, StorageBackend}; +use storage::file::File; +use storage::json::parser::JsonHeaderParser; +use storage::parser::{Parser, FileHeaderParser}; +use ui::file::{FilePrinter, TablePrinter}; + pub fn add_command(module: &Module, env: CommandEnv) -> CommandResult { use url::Url; diff --git a/src/module/bm/header.rs b/src/module/bm/header.rs index 10f20d80..e2479048 100644 --- a/src/module/bm/header.rs +++ b/src/module/bm/header.rs @@ -1,7 +1,8 @@ -use storage::file::FileHeaderSpec as FHS; -use storage::file::FileHeaderData as FHD; use std::ops::Deref; +use storage::file::FileHeaderData as FHD; +use storage::file::FileHeaderSpec as FHS; + pub fn get_spec() -> FHS { FHS::Map { keys: vec![ url_key(), tags_key() ] } } diff --git a/src/module/bm/mod.rs b/src/module/bm/mod.rs index e963564b..216665ca 100644 --- a/src/module/bm/mod.rs +++ b/src/module/bm/mod.rs @@ -1,25 +1,21 @@ -use runtime::Runtime; -use module::Module; -use module::CommandMap; -use module::ModuleResult; -use module::ModuleError; -use std::path::Path; -use std::result::Result; -use std::fmt::Result as FMTResult; -use std::fmt::Formatter; -use std::fmt::Debug; -use clap::ArgMatches; -use regex::Regex; - mod header; mod commands; +use std::fmt::{Debug, Formatter}; +use std::fmt::Result as FMTResult; +use std::path::Path; +use std::result::Result; + +use clap::ArgMatches; +use regex::Regex; + +use module::{CommandMap, Module, ModuleError, ModuleResult}; +use runtime::Runtime; +use self::commands::*; use self::header::build_header; use storage::json::parser::JsonHeaderParser; use storage::parser::FileHeaderParser; -use self::commands::*; - pub struct BMModule { path: Option, } diff --git a/src/module/mod.rs b/src/module/mod.rs index 7d0d0562..a0d9a467 100644 --- a/src/module/mod.rs +++ b/src/module/mod.rs @@ -1,15 +1,13 @@ -use runtime::Runtime; +use std::collections::HashMap; use std::error::Error; -use std::fmt::Formatter; +use std::fmt::{Debug, Display, Formatter}; use std::fmt::Result as FMTResult; -use std::fmt::Display; -use std::fmt::Debug; use std::path::Path; use std::result::Result; -use std::collections::HashMap; use clap::{App, ArgMatches}; +use runtime::Runtime; use storage::backend::{StorageBackend, StorageBackendError}; pub mod bm; diff --git a/src/runtime.rs b/src/runtime.rs index a666c1bf..92c38f6e 100644 --- a/src/runtime.rs +++ b/src/runtime.rs @@ -1,14 +1,11 @@ +use std::fmt::{Debug, Formatter, Error}; + extern crate log; +use log::{LogRecord, LogLevel, LogLevelFilter, LogMetadata, SetLoggerError}; pub use cli::CliConfig; pub use configuration::Configuration as Cfg; -use std::fmt::Debug; -use std::fmt::Formatter; -use std::fmt::Error; - -use log::{LogRecord, LogLevel, LogLevelFilter, LogMetadata, SetLoggerError}; - pub struct ImagLogger { lvl: LogLevel, } diff --git a/src/storage/backend.rs b/src/storage/backend.rs index ead88f1a..9e56778d 100644 --- a/src/storage/backend.rs +++ b/src/storage/backend.rs @@ -1,27 +1,21 @@ use std::error::Error; -use std::fmt::Display; -use std::fmt::Formatter; +use std::fmt::{Display, Formatter}; use std::fmt::Result as FMTResult; -use std::path::Path; -use std::path::PathBuf; -use std::vec::Vec; use std::fs::File as FSFile; -use std::fs::create_dir_all; -use std::fs::remove_file; -use std::io::Read; -use std::io::Write; -use std::vec::IntoIter; +use std::fs::{create_dir_all, remove_file}; +use std::io::{Read, Write}; +use std::path::{Path, PathBuf}; +use std::vec::{Vec, IntoIter}; use glob::glob; use glob::Paths; +use module::Module; +use runtime::Runtime; use storage::file::File; use storage::file_id::*; use storage::parser::{FileHeaderParser, Parser, ParserError}; -use module::Module; -use runtime::Runtime; - pub type BackendOperationResult = Result; pub struct StorageBackend { diff --git a/src/storage/file.rs b/src/storage/file.rs index da7dd66e..7a14bb5d 100644 --- a/src/storage/file.rs +++ b/src/storage/file.rs @@ -2,12 +2,12 @@ use std::error::Error; use std::fmt::{Debug, Display, Formatter}; use std::fmt; -use module::Module; -use super::parser::{FileHeaderParser, Parser, ParserError}; -use storage::file_id::*; - use regex::Regex; +use module::Module; +use storage::file_id::*; +use super::parser::{FileHeaderParser, Parser, ParserError}; + #[derive(Debug)] #[derive(Clone)] pub enum FileHeaderSpec { diff --git a/src/storage/file_id.rs b/src/storage/file_id.rs index da44de36..7a1353ce 100644 --- a/src/storage/file_id.rs +++ b/src/storage/file_id.rs @@ -1,10 +1,9 @@ +use std::convert::{From, Into}; use std::error::Error; use std::fmt::{Debug, Display, Formatter}; use std::fmt; -use std::result::Result; use std::path::{Path, PathBuf}; -use std::convert::From; -use std::convert::Into; +use std::result::Result; use regex::Regex; diff --git a/src/storage/json/parser.rs b/src/storage/json/parser.rs index 40675583..942edb1b 100644 --- a/src/storage/json/parser.rs +++ b/src/storage/json/parser.rs @@ -1,16 +1,15 @@ +use std::collections::HashMap; +use std::io::stdout; +use std::error::Error; + use serde_json::{Value, from_str}; use serde_json::error::Result as R; use serde_json::Serializer; use serde::ser::Serialize; use serde::ser::Serializer as Ser; -use std::collections::HashMap; -use std::io::stdout; -use std::error::Error; - -use super::super::parser::{FileHeaderParser, ParserError}; -use super::super::file::{FileHeaderSpec, FileHeaderData}; - +use storage::parser::{FileHeaderParser, ParserError}; +use storage::file::{FileHeaderSpec, FileHeaderData}; pub struct JsonHeaderParser { spec: Option, diff --git a/src/storage/parser.rs b/src/storage/parser.rs index 373c6f61..71617724 100644 --- a/src/storage/parser.rs +++ b/src/storage/parser.rs @@ -1,8 +1,9 @@ -use regex::Regex; use std::error::Error; use std::fmt::{Debug, Display, Formatter}; use std::fmt; +use regex::Regex; + use super::file::{FileHeaderSpec, FileHeaderData}; pub struct ParserError {