It's hardly worth giving Exa its own constructor

This commit is contained in:
Ben S 2015-09-03 13:38:18 +01:00
parent 83f05ffb3c
commit a14f1d82f0

View File

@ -39,17 +39,11 @@ mod output;
mod term; mod term;
#[cfg(not(test))]
struct Exa { struct Exa {
options: Options, options: Options,
} }
#[cfg(not(test))]
impl Exa { impl Exa {
fn new(options: Options) -> Exa {
Exa { options: options }
}
fn run(&mut self, args_file_names: &[String]) { fn run(&mut self, args_file_names: &[String]) {
let mut files = Vec::new(); let mut files = Vec::new();
let mut dirs = Vec::new(); let mut dirs = Vec::new();
@ -145,13 +139,12 @@ impl Exa {
} }
#[cfg(not(test))]
fn main() { fn main() {
let args: Vec<String> = env::args().skip(1).collect(); let args: Vec<String> = env::args().skip(1).collect();
match Options::getopts(&args) { match Options::getopts(&args) {
Ok((options, paths)) => { Ok((options, paths)) => {
let mut exa = Exa::new(options); let mut exa = Exa { options: options };
exa.run(&paths); exa.run(&paths);
}, },
Err(e) => { Err(e) => {