Resort "use"

First comes std stuff
Second is external crates
Then we have own modules

All in alphabetical order and as few lines as possible if readability is
preserved.
This commit is contained in:
Matthias Beyer 2015-12-05 01:14:13 +01:00
parent 5953563671
commit f7a92b6e79
13 changed files with 57 additions and 84 deletions

View file

@ -1,10 +1,8 @@
use std::fmt::{Debug, Formatter, Error};
extern crate clap; extern crate clap;
use clap::{App, ArgMatches}; use clap::{App, ArgMatches};
use std::fmt::Debug;
use std::fmt::Formatter;
use std::fmt::Error;
pub struct ModuleConfig { pub struct ModuleConfig {
pub load : bool, pub load : bool,
} }

View file

@ -1,14 +1,9 @@
extern crate clap; use std::fmt::{Debug, Formatter, Error};
use cli::CliConfig;
use std::path::Path; use std::path::Path;
use config::reader::from_file; use config::reader::from_file;
use config::types::Config as Cfg; use config::types::Config as Cfg;
use cli::CliConfig;
use std::fmt::Debug;
use std::fmt::Formatter;
use std::fmt::Error;
pub struct Configuration { pub struct Configuration {
pub rtp : String, pub rtp : String,

View file

@ -11,6 +11,8 @@
extern crate url; extern crate url;
extern crate config; extern crate config;
use std::process::exit;
use cli::CliConfig; use cli::CliConfig;
use configuration::Configuration; use configuration::Configuration;
use runtime::{ImagLogger, Runtime}; use runtime::{ImagLogger, Runtime};
@ -28,8 +30,6 @@ mod module;
mod storage; mod storage;
mod ui; mod ui;
use std::process::exit;
fn main() { fn main() {
let yaml = load_yaml!("../etc/cli.yml"); let yaml = load_yaml!("../etc/cli.yml");
let app = App::from_yaml(yaml); let app = App::from_yaml(yaml);

View file

@ -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 std::vec::IntoIter;
use clap::ArgMatches; use clap::ArgMatches;
use regex::Regex; 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 { pub fn add_command(module: &Module, env: CommandEnv) -> CommandResult {
use url::Url; use url::Url;

View file

@ -1,7 +1,8 @@
use storage::file::FileHeaderSpec as FHS;
use storage::file::FileHeaderData as FHD;
use std::ops::Deref; use std::ops::Deref;
use storage::file::FileHeaderData as FHD;
use storage::file::FileHeaderSpec as FHS;
pub fn get_spec() -> FHS { pub fn get_spec() -> FHS {
FHS::Map { keys: vec![ url_key(), tags_key() ] } FHS::Map { keys: vec![ url_key(), tags_key() ] }
} }

View file

@ -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 header;
mod commands; 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 self::header::build_header;
use storage::json::parser::JsonHeaderParser; use storage::json::parser::JsonHeaderParser;
use storage::parser::FileHeaderParser; use storage::parser::FileHeaderParser;
use self::commands::*;
pub struct BMModule { pub struct BMModule {
path: Option<String>, path: Option<String>,
} }

View file

@ -1,15 +1,13 @@
use runtime::Runtime; use std::collections::HashMap;
use std::error::Error; use std::error::Error;
use std::fmt::Formatter; use std::fmt::{Debug, Display, Formatter};
use std::fmt::Result as FMTResult; use std::fmt::Result as FMTResult;
use std::fmt::Display;
use std::fmt::Debug;
use std::path::Path; use std::path::Path;
use std::result::Result; use std::result::Result;
use std::collections::HashMap;
use clap::{App, ArgMatches}; use clap::{App, ArgMatches};
use runtime::Runtime;
use storage::backend::{StorageBackend, StorageBackendError}; use storage::backend::{StorageBackend, StorageBackendError};
pub mod bm; pub mod bm;

View file

@ -1,14 +1,11 @@
use std::fmt::{Debug, Formatter, Error};
extern crate log; extern crate log;
use log::{LogRecord, LogLevel, LogLevelFilter, LogMetadata, SetLoggerError};
pub use cli::CliConfig; pub use cli::CliConfig;
pub use configuration::Configuration as Cfg; 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 { pub struct ImagLogger {
lvl: LogLevel, lvl: LogLevel,
} }

View file

@ -1,27 +1,21 @@
use std::error::Error; use std::error::Error;
use std::fmt::Display; use std::fmt::{Display, Formatter};
use std::fmt::Formatter;
use std::fmt::Result as FMTResult; 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::File as FSFile;
use std::fs::create_dir_all; use std::fs::{create_dir_all, remove_file};
use std::fs::remove_file; use std::io::{Read, Write};
use std::io::Read; use std::path::{Path, PathBuf};
use std::io::Write; use std::vec::{Vec, IntoIter};
use std::vec::IntoIter;
use glob::glob; use glob::glob;
use glob::Paths; use glob::Paths;
use module::Module;
use runtime::Runtime;
use storage::file::File; use storage::file::File;
use storage::file_id::*; use storage::file_id::*;
use storage::parser::{FileHeaderParser, Parser, ParserError}; use storage::parser::{FileHeaderParser, Parser, ParserError};
use module::Module;
use runtime::Runtime;
pub type BackendOperationResult<T = ()> = Result<T, StorageBackendError>; pub type BackendOperationResult<T = ()> = Result<T, StorageBackendError>;
pub struct StorageBackend { pub struct StorageBackend {

View file

@ -2,12 +2,12 @@ use std::error::Error;
use std::fmt::{Debug, Display, Formatter}; use std::fmt::{Debug, Display, Formatter};
use std::fmt; use std::fmt;
use module::Module;
use super::parser::{FileHeaderParser, Parser, ParserError};
use storage::file_id::*;
use regex::Regex; use regex::Regex;
use module::Module;
use storage::file_id::*;
use super::parser::{FileHeaderParser, Parser, ParserError};
#[derive(Debug)] #[derive(Debug)]
#[derive(Clone)] #[derive(Clone)]
pub enum FileHeaderSpec { pub enum FileHeaderSpec {

View file

@ -1,10 +1,9 @@
use std::convert::{From, Into};
use std::error::Error; use std::error::Error;
use std::fmt::{Debug, Display, Formatter}; use std::fmt::{Debug, Display, Formatter};
use std::fmt; use std::fmt;
use std::result::Result;
use std::path::{Path, PathBuf}; use std::path::{Path, PathBuf};
use std::convert::From; use std::result::Result;
use std::convert::Into;
use regex::Regex; use regex::Regex;

View file

@ -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::{Value, from_str};
use serde_json::error::Result as R; use serde_json::error::Result as R;
use serde_json::Serializer; use serde_json::Serializer;
use serde::ser::Serialize; use serde::ser::Serialize;
use serde::ser::Serializer as Ser; use serde::ser::Serializer as Ser;
use std::collections::HashMap; use storage::parser::{FileHeaderParser, ParserError};
use std::io::stdout; use storage::file::{FileHeaderSpec, FileHeaderData};
use std::error::Error;
use super::super::parser::{FileHeaderParser, ParserError};
use super::super::file::{FileHeaderSpec, FileHeaderData};
pub struct JsonHeaderParser { pub struct JsonHeaderParser {
spec: Option<FileHeaderSpec>, spec: Option<FileHeaderSpec>,

View file

@ -1,8 +1,9 @@
use regex::Regex;
use std::error::Error; use std::error::Error;
use std::fmt::{Debug, Display, Formatter}; use std::fmt::{Debug, Display, Formatter};
use std::fmt; use std::fmt;
use regex::Regex;
use super::file::{FileHeaderSpec, FileHeaderData}; use super::file::{FileHeaderSpec, FileHeaderData};
pub struct ParserError { pub struct ParserError {