maybe don't depend on regex 0u0;

This commit is contained in:
Lynne Megido 2021-02-05 23:34:02 +10:00
parent 2c4a8f6a3b
commit 5f36f663fc
Signed by: lynnesbian
GPG key ID: F0A184B5213D9F90
3 changed files with 19 additions and 50 deletions

44
Cargo.lock generated
View file

@ -1,14 +1,5 @@
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
[[package]]
name = "aho-corasick"
version = "0.7.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7404febffaa47dac81aa44dba71523c9d069b1bdc50a77db41195149e17f68e5"
dependencies = [
"memchr",
]
[[package]]
name = "arrayvec"
version = "0.5.2"
@ -258,9 +249,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f26ecb66b4bdca6c1409b40fb255eefc2bd4f6d135dab3c3124f80ffa2a9661e"
dependencies = [
"atty",
"humantime",
"log",
"regex",
"termcolor",
]
@ -427,12 +416,6 @@ dependencies = [
"libc",
]
[[package]]
name = "humantime"
version = "2.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4"
[[package]]
name = "ident_case"
version = "1.0.1"
@ -657,24 +640,6 @@ dependencies = [
"redox_syscall",
]
[[package]]
name = "regex"
version = "1.4.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d9251239e129e16308e70d853559389de218ac275b515068abc96829d05b948a"
dependencies = [
"aho-corasick",
"memchr",
"regex-syntax",
"thread_local",
]
[[package]]
name = "regex-syntax"
version = "0.6.22"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b5eb417147ba9860a96cfe72a0b93bf88fee1744b5636ec99ab20c1aa9376581"
[[package]]
name = "ryu"
version = "1.0.5"
@ -769,15 +734,6 @@ dependencies = [
"unicode-width",
]
[[package]]
name = "thread_local"
version = "1.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d8208a331e1cb318dd5bd76951d2b8fc48ca38a69f5f4e4af1b6a9f8c6236915"
dependencies = [
"once_cell",
]
[[package]]
name = "unicase"
version = "2.6.0"

View file

@ -9,7 +9,6 @@ license = "GPL-3.0-or-later"
[dependencies]
walkdir = "2.3.1"
log = "0.4.14"
env_logger = "0.8.2"
smartstring = "0.2.6"
# use git version while waiting on a release incorporating https://github.com/ebassi/xdg-mime-rs/commit/de5a6dd
xdg-mime = {git = "https://github.com/ebassi/xdg-mime-rs", version = "0.3"}
@ -20,3 +19,11 @@ cached = "0.23.0"
[dependencies.clap]
version = "3.0.0-beta.2"
features = ["wrap_help"]
[dependencies.env_logger]
version = "0.8.2"
default-features = false
features = ["termcolor", "atty"]
[profile.release]
lto = "thin"

View file

@ -19,11 +19,11 @@ mod inspectors;
use std::path::{Path, PathBuf};
use walkdir::{WalkDir, DirEntry};
use mime_guess::Mime;
use smartstring::alias::String;
use clap::Clap;
use log::{debug, info, warn, error};
use log::{debug, trace, info, warn, error};
use rayon::prelude::*;
use mime_guess::Mime;
struct Findings {
file: PathBuf,
@ -84,9 +84,15 @@ fn extension_from_path(path: &Path) -> Option<String> {
fn main() {
let args = parameters::Parameters::parse();
env_logger::init();
let mut builder = env_logger::Builder::from_default_env();
builder
// .format(|buf, r| writeln!(buf, "{} - {}", r.level(), r.args()))
.format_module_path(false)
.format_timestamp(None)
.init();
let db = xdg_mime::SharedMimeInfo::new();
debug!("=====\nIterating directory: {:?}\n=====", args.dirs);
debug!("Iterating directory: {:?}", args.dirs);
let stepper = WalkDir::new(&args.dirs).into_iter();
let entries: Vec<DirEntry> = stepper
@ -142,7 +148,7 @@ fn main() {
for result in results {
match result {
Ok(r) => info!("{:#?}: {:#?} - {:?} - {:?}", r.file, r.mime, r.valid, r.recommended_extension()),
Ok(r) => trace!("{:#?}: {:#?} - {:?} - {:?}", r.file, r.mime, r.valid, r.recommended_extension()),
Err(f) => warn!("{:#?}: Error 0uo", f)
}
}