diff options
author | Erin Power <xampprocky@gmail.com> | 2020-02-14 14:21:20 +0100 |
---|---|---|
committer | Erin Power <xampprocky@gmail.com> | 2020-02-16 18:19:05 +0100 |
commit | fdf3f8cb279a7aeac0696c87e5d8b0cd946e4f9e (patch) | |
tree | 13e4468d89a90c73800c5407249969618d8ddd3e | |
parent | 93921c2deb2c2b5e703aa247c42cbc52452631b1 (diff) |
Minor refactor and fix warningv10.1.2
-rw-r--r-- | Cargo.toml | 26 | ||||
-rw-r--r-- | build.rs | 2 | ||||
-rw-r--r-- | src/main.rs | 14 |
3 files changed, 20 insertions, 22 deletions
@@ -13,10 +13,20 @@ readme = "README.md" repository = "https://github.com/XAMPPRocky/tokei.git" version = "10.1.2" -[badges] +[features] +all = ["json", "cbor", "yaml"] +cbor = ["hex", "serde_cbor"] +default = [] +json = ["serde_json"] +yaml = ["serde_yaml"] + +[profile.release] +lto = true +panic = "abort" +debug = true + [badges.appveyor] repository = "XAMPPRocky/tokei" - [badges.travis-ci] repository = "XAMPPRocky/tokei" @@ -65,15 +75,3 @@ lazy_static = "1.4.0" regex = "1.3.4" tempfile = "3.0.8" git2 = { version = "0.11.0", default-features = false, features = [] } - -[features] -all = ["json", "cbor", "yaml"] -cbor = ["hex", "serde_cbor"] -default = [] -json = ["serde_json"] -yaml = ["serde_yaml"] - -[profile] -[profile.release] -lto = true -panic = "abort" @@ -73,7 +73,7 @@ fn generate_tests(out_dir: &OsStr) -> Result<(), Box<dyn error::Error>> { let mut string = String::with_capacity(INITIAL_BUFFER_SIZE); let walker = Walk::new("./tests/data/").filter(|p| match p { - &Ok(ref p) => { + Ok(ref p) => { if let Ok(ref p) = p.metadata() { p.is_file() } else { diff --git a/src/main.rs b/src/main.rs index 430e0dd..14544c0 100644 --- a/src/main.rs +++ b/src/main.rs @@ -42,13 +42,6 @@ fn main() -> Result<(), Box<dyn Error>> { } } - languages.get_statistics(&input, &cli.ignored_directories(), &config); - - if let Some(format) = cli.output { - print!("{}", format.print(languages).unwrap()); - process::exit(0); - } - let columns = cli .columns .or(config.columns) @@ -62,6 +55,13 @@ fn main() -> Result<(), Box<dyn Error>> { .unwrap_or(FALLBACK_ROW_LEN) .max(FALLBACK_ROW_LEN); + languages.get_statistics(&input, &cli.ignored_directories(), &config); + + if let Some(format) = cli.output { + print!("{}", format.print(languages).unwrap()); + process::exit(0); + } + let row = "-".repeat(columns); let mut stdout = io::BufWriter::new(io::stdout()); |