diff --git a/Cargo.toml b/Cargo.toml index 256705e..d5ca04b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -10,9 +10,8 @@ rust-version = "1.43.0" # cached requires 1.42.0 #license-file = "LICENSE" [features] -default = ["mini-buffer", "multi-threaded", "infer-backend"] -mini-buffer = [] -multi-threaded = [] +default = ["multi-threaded", "infer-backend"] +multi-threaded = ["rayon"] infer-backend = ["infer"] xdg-mime-backend = ["xdg-mime"] @@ -21,9 +20,9 @@ walkdir = "2.3.1" log = "0.4.14" smartstring = "0.2.6" mime_guess = "2.0.3" -rayon = "1.5.0" snailquote = "0.3.0" once_cell = "1.5.2" +rayon = { version = "1.5.0", optional = true } infer = { version = "0.3.4", optional = true } # 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", rev = "de5a6dd", optional = true } diff --git a/src/inspectors.rs b/src/inspectors.rs index 9f59134..a1e5272 100644 --- a/src/inspectors.rs +++ b/src/inspectors.rs @@ -23,6 +23,7 @@ const BUF_SIZE: usize = 512; pub fn mime_type(db: &T, path: &Path) -> io::Result, > { // attempt to read up to the BUF_SIZE bytes of the file + let mut buffer = [0; 64]; let mut file = File::open(path)?; diff --git a/src/mimedb.rs b/src/mimedb.rs index baf0e0b..714bd7d 100644 --- a/src/mimedb.rs +++ b/src/mimedb.rs @@ -1,6 +1,6 @@ -use std::str::FromStr; - use mime_guess::Mime; +#[cfg(feature = "infer-backend")] + use std::str::FromStr; pub trait MimeDb { fn init() -> Self;