diff --git a/Cargo.lock b/Cargo.lock index 8e4ac7e66..573a82f42 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -224,7 +224,6 @@ dependencies = [ "grep-regex", "grep-searcher", "serde", - "serde_derive", "serde_json", "termcolor", ] @@ -500,6 +499,9 @@ name = "serde" version = "1.0.125" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "558dc50e1a5a5fa7112ca2ce4effcb321b0300c0d4ccf0776a9f60cd89031171" +dependencies = [ + "serde_derive", +] [[package]] name = "serde_derive" diff --git a/crates/cli/README.md b/crates/cli/README.md index c1cc02bdd..c3fb875c6 100644 --- a/crates/cli/README.md +++ b/crates/cli/README.md @@ -29,9 +29,3 @@ Add this to your `Cargo.toml`: [dependencies] grep-cli = "0.1" ``` - -and this to your crate root: - -```rust -extern crate grep_cli; -``` diff --git a/crates/cli/src/decompress.rs b/crates/cli/src/decompress.rs index f9637accb..365660ce7 100644 --- a/crates/cli/src/decompress.rs +++ b/crates/cli/src/decompress.rs @@ -230,7 +230,7 @@ impl DecompressionReaderBuilder { match self.command_builder.build(&mut cmd) { Ok(cmd_reader) => Ok(DecompressionReader { rdr: Ok(cmd_reader) }), Err(err) => { - debug!( + log::debug!( "{}: error spawning command '{:?}': {} \ (falling back to uncompressed reader)", path.display(), @@ -479,7 +479,7 @@ fn default_decompression_commands() -> Vec { let bin = match resolve_binary(Path::new(args[0])) { Ok(bin) => bin, Err(err) => { - debug!("{}", err); + log::debug!("{}", err); return; } }; diff --git a/crates/cli/src/human.rs b/crates/cli/src/human.rs index 071617380..2c4213db4 100644 --- a/crates/cli/src/human.rs +++ b/crates/cli/src/human.rs @@ -88,7 +88,7 @@ impl From for io::Error { /// /// Additional suffixes may be added over time. pub fn parse_human_readable_size(size: &str) -> Result { - lazy_static! { + lazy_static::lazy_static! { // Normally I'd just parse something this simple by hand to avoid the // regex dep, but we bring regex in any way for glob matching, so might // as well use it. diff --git a/crates/cli/src/lib.rs b/crates/cli/src/lib.rs index c9a6aa9c1..3b928e8a5 100644 --- a/crates/cli/src/lib.rs +++ b/crates/cli/src/lib.rs @@ -158,13 +158,6 @@ error message is crafted that typically tells the user how to fix the problem. #![deny(missing_docs)] -use atty; - -#[macro_use] -extern crate lazy_static; -#[macro_use] -extern crate log; - mod decompress; mod escape; mod human; diff --git a/crates/cli/src/process.rs b/crates/cli/src/process.rs index d0d490c22..277f01827 100644 --- a/crates/cli/src/process.rs +++ b/crates/cli/src/process.rs @@ -254,7 +254,7 @@ impl CommandReader { impl Drop for CommandReader { fn drop(&mut self) { if let Err(error) = self.close() { - warn!("{}", error); + log::warn!("{}", error); } } } diff --git a/crates/globset/README.md b/crates/globset/README.md index 17cab82c0..806c915b9 100644 --- a/crates/globset/README.md +++ b/crates/globset/README.md @@ -22,12 +22,6 @@ Add this to your `Cargo.toml`: globset = "0.3" ``` -and this to your crate root: - -```rust -extern crate globset; -``` - ### Features * `serde1`: Enables implementing Serde traits on the `Glob` type. diff --git a/crates/globset/benches/bench.rs b/crates/globset/benches/bench.rs index c2619813d..1344a8f65 100644 --- a/crates/globset/benches/bench.rs +++ b/crates/globset/benches/bench.rs @@ -4,9 +4,6 @@ tool itself, see the benchsuite directory. */ #![feature(test)] -use glob; - - extern crate test; use globset::{Candidate, Glob, GlobMatcher, GlobSet, GlobSetBuilder}; diff --git a/crates/globset/src/lib.rs b/crates/globset/src/lib.rs index f5273e023..d14685f14 100644 --- a/crates/globset/src/lib.rs +++ b/crates/globset/src/lib.rs @@ -103,16 +103,6 @@ or to enable case insensitive matching. #![deny(missing_docs)] - - -use fnv; -#[macro_use] -extern crate log; -use regex; - -#[cfg(feature = "serde1")] -extern crate serde; - use std::borrow::Cow; use std::collections::{BTreeMap, HashMap}; use std::error::Error as StdError; @@ -423,12 +413,12 @@ impl GlobSet { required_exts.add(i, ext, p.regex().to_owned()); } MatchStrategy::Regex => { - debug!("glob converted to regex: {:?}", p); + log::debug!("glob converted to regex: {:?}", p); regexes.add(i, p.regex().to_owned()); } } } - debug!( + log::debug!( "built glob set; {} literals, {} basenames, {} extensions, \ {} prefixes, {} suffixes, {} required extensions, {} regexes", lits.0.len(), @@ -556,7 +546,11 @@ impl GlobSetMatchStrategy { } } - fn matches_into(&self, candidate: &Candidate<'_>, matches: &mut Vec) { + fn matches_into( + &self, + candidate: &Candidate<'_>, + matches: &mut Vec, + ) { use self::GlobSetMatchStrategy::*; match *self { Literal(ref s) => s.matches_into(candidate, matches), @@ -587,7 +581,11 @@ impl LiteralStrategy { } #[inline(never)] - fn matches_into(&self, candidate: &Candidate<'_>, matches: &mut Vec) { + fn matches_into( + &self, + candidate: &Candidate<'_>, + matches: &mut Vec, + ) { if let Some(hits) = self.0.get(candidate.path.as_bytes()) { matches.extend(hits); } @@ -614,7 +612,11 @@ impl BasenameLiteralStrategy { } #[inline(never)] - fn matches_into(&self, candidate: &Candidate<'_>, matches: &mut Vec) { + fn matches_into( + &self, + candidate: &Candidate<'_>, + matches: &mut Vec, + ) { if candidate.basename.is_empty() { return; } @@ -644,7 +646,11 @@ impl ExtensionStrategy { } #[inline(never)] - fn matches_into(&self, candidate: &Candidate<'_>, matches: &mut Vec) { + fn matches_into( + &self, + candidate: &Candidate<'_>, + matches: &mut Vec, + ) { if candidate.ext.is_empty() { return; } @@ -672,7 +678,11 @@ impl PrefixStrategy { false } - fn matches_into(&self, candidate: &Candidate<'_>, matches: &mut Vec) { + fn matches_into( + &self, + candidate: &Candidate<'_>, + matches: &mut Vec, + ) { let path = candidate.path_prefix(self.longest); for m in self.matcher.find_overlapping_iter(path) { if m.start() == 0 { @@ -700,7 +710,11 @@ impl SuffixStrategy { false } - fn matches_into(&self, candidate: &Candidate<'_>, matches: &mut Vec) { + fn matches_into( + &self, + candidate: &Candidate<'_>, + matches: &mut Vec, + ) { let path = candidate.path_suffix(self.longest); for m in self.matcher.find_overlapping_iter(path) { if m.end() == path.len() { @@ -732,7 +746,11 @@ impl RequiredExtensionStrategy { } #[inline(never)] - fn matches_into(&self, candidate: &Candidate<'_>, matches: &mut Vec) { + fn matches_into( + &self, + candidate: &Candidate<'_>, + matches: &mut Vec, + ) { if candidate.ext.is_empty() { return; } @@ -757,7 +775,11 @@ impl RegexSetStrategy { self.matcher.is_match(candidate.path.as_bytes()) } - fn matches_into(&self, candidate: &Candidate<'_>, matches: &mut Vec) { + fn matches_into( + &self, + candidate: &Candidate<'_>, + matches: &mut Vec, + ) { for i in self.matcher.matches(candidate.path.as_bytes()) { matches.push(self.map[i]); } diff --git a/crates/grep/README.md b/crates/grep/README.md index b9df4dc0e..41071ff0a 100644 --- a/crates/grep/README.md +++ b/crates/grep/README.md @@ -26,12 +26,6 @@ Add this to your `Cargo.toml`: grep = "0.2" ``` -and this to your crate root: - -```rust -extern crate grep; -``` - ### Features diff --git a/crates/ignore/README.md b/crates/ignore/README.md index d9213ec62..72258e6b5 100644 --- a/crates/ignore/README.md +++ b/crates/ignore/README.md @@ -22,12 +22,6 @@ Add this to your `Cargo.toml`: ignore = "0.4" ``` -and this to your crate root: - -```rust -extern crate ignore; -``` - ### Example This example shows the most basic usage of this crate. This code will diff --git a/crates/ignore/examples/walk.rs b/crates/ignore/examples/walk.rs index 969bd1cb0..e064478c5 100644 --- a/crates/ignore/examples/walk.rs +++ b/crates/ignore/examples/walk.rs @@ -1,7 +1,3 @@ -extern crate crossbeam_channel as channel; -use ignore; -use walkdir; - use std::env; use std::io::{self, Write}; use std::path::Path; @@ -14,7 +10,7 @@ fn main() { let mut path = env::args().nth(1).unwrap(); let mut parallel = false; let mut simple = false; - let (tx, rx) = channel::bounded::(100); + let (tx, rx) = crossbeam_channel::bounded::(100); if path == "parallel" { path = env::args().nth(2).unwrap(); parallel = true; diff --git a/crates/ignore/src/dir.rs b/crates/ignore/src/dir.rs index 18ab9abf0..09414e9a6 100644 --- a/crates/ignore/src/dir.rs +++ b/crates/ignore/src/dir.rs @@ -581,7 +581,7 @@ impl IgnoreBuilder { .unwrap(); let (gi, err) = builder.build_global(); if let Some(err) = err { - debug!("{}", err); + log::debug!("{}", err); } gi }; diff --git a/crates/ignore/src/gitignore.rs b/crates/ignore/src/gitignore.rs index 6eea9c4a9..7922651cb 100644 --- a/crates/ignore/src/gitignore.rs +++ b/crates/ignore/src/gitignore.rs @@ -592,7 +592,7 @@ fn parse_excludes_file(data: &[u8]) -> Option { // N.B. This is the lazy approach, and isn't technically correct, but // probably works in more circumstances. I guess we would ideally have // a full INI parser. Yuck. - lazy_static! { + lazy_static::lazy_static! { static ref RE: Regex = Regex::new(r"(?im)^\s*excludesfile\s*=\s*(.+)\s*$").unwrap(); }; diff --git a/crates/ignore/src/lib.rs b/crates/ignore/src/lib.rs index 3c82231d2..824f7c4dc 100644 --- a/crates/ignore/src/lib.rs +++ b/crates/ignore/src/lib.rs @@ -46,19 +46,6 @@ See the documentation for `WalkBuilder` for many other options. #![deny(missing_docs)] - -#[macro_use] -extern crate lazy_static; -#[macro_use] -extern crate log; - - - - -use walkdir; -#[cfg(windows)] -extern crate winapi_util; - use std::error; use std::fmt; use std::io; diff --git a/crates/ignore/src/types.rs b/crates/ignore/src/types.rs index 62275b407..efb9a8d9b 100644 --- a/crates/ignore/src/types.rs +++ b/crates/ignore/src/types.rs @@ -427,7 +427,7 @@ impl TypesBuilder { /// If `name` is `all` or otherwise contains any character that is not a /// Unicode letter or number, then an error is returned. pub fn add(&mut self, name: &str, glob: &str) -> Result<(), Error> { - lazy_static! { + lazy_static::lazy_static! { static ref RE: Regex = Regex::new(r"^[\pL\pN]+$").unwrap(); }; if name == "all" || !RE.is_match(name) { diff --git a/crates/ignore/src/walk.rs b/crates/ignore/src/walk.rs index fac8c2793..b381197ef 100644 --- a/crates/ignore/src/walk.rs +++ b/crates/ignore/src/walk.rs @@ -1725,7 +1725,7 @@ fn skip_filesize( if let Some(fs) = filesize { if fs > max_filesize { - debug!("ignoring {}: {} bytes", path.display(), fs); + log::debug!("ignoring {}: {} bytes", path.display(), fs); true } else { false @@ -1738,10 +1738,10 @@ fn skip_filesize( fn should_skip_entry(ig: &Ignore, dent: &DirEntry) -> bool { let m = ig.matched_dir_entry(dent); if m.is_ignore() { - debug!("ignoring {}: {:?}", dent.path().display(), m); + log::debug!("ignoring {}: {:?}", dent.path().display(), m); true } else if m.is_whitelist() { - debug!("whitelisting {}: {:?}", dent.path().display(), m); + log::debug!("whitelisting {}: {:?}", dent.path().display(), m); false } else { false diff --git a/crates/matcher/README.md b/crates/matcher/README.md index dc77ecff6..e521d937f 100644 --- a/crates/matcher/README.md +++ b/crates/matcher/README.md @@ -27,9 +27,3 @@ Add this to your `Cargo.toml`: [dependencies] grep-matcher = "0.1" ``` - -and this to your crate root: - -```rust -extern crate grep_matcher; -``` diff --git a/crates/pcre2/README.md b/crates/pcre2/README.md index 68350676c..43dff1663 100644 --- a/crates/pcre2/README.md +++ b/crates/pcre2/README.md @@ -30,9 +30,3 @@ Add this to your `Cargo.toml`: [dependencies] grep-pcre2 = "0.1" ``` - -and this to your crate root: - -```rust -extern crate grep_pcre2; -``` diff --git a/crates/printer/Cargo.toml b/crates/printer/Cargo.toml index 05e601d2f..375451d23 100644 --- a/crates/printer/Cargo.toml +++ b/crates/printer/Cargo.toml @@ -16,7 +16,7 @@ edition = "2018" [features] default = ["serde1"] -serde1 = ["base64", "serde", "serde_derive", "serde_json"] +serde1 = ["base64", "serde", "serde_json"] [dependencies] base64 = { version = "0.13.0", optional = true } @@ -24,8 +24,7 @@ bstr = "0.2.0" grep-matcher = { version = "0.1.2", path = "../matcher" } grep-searcher = { version = "0.1.4", path = "../searcher" } termcolor = "1.0.4" -serde = { version = "1.0.77", optional = true } -serde_derive = { version = "1.0.77", optional = true } +serde = { version = "1.0.77", optional = true, features = ["derive"] } serde_json = { version = "1.0.27", optional = true } [dev-dependencies] diff --git a/crates/printer/README.md b/crates/printer/README.md index a0b3653fa..869fbd5f1 100644 --- a/crates/printer/README.md +++ b/crates/printer/README.md @@ -26,9 +26,3 @@ Add this to your `Cargo.toml`: [dependencies] grep-printer = "0.1" ``` - -and this to your crate root: - -```rust -extern crate grep_printer; -``` diff --git a/crates/printer/src/color.rs b/crates/printer/src/color.rs index d1a970ead..11d2c3e62 100644 --- a/crates/printer/src/color.rs +++ b/crates/printer/src/color.rs @@ -147,9 +147,6 @@ pub struct ColorSpecs { /// A `UserColorSpec` can also be converted to a `termcolor::ColorSpec`: /// /// ```rust -/// extern crate grep_printer; -/// extern crate termcolor; -/// /// # fn main() { /// use termcolor::{Color, ColorSpec}; /// use grep_printer::UserColorSpec; diff --git a/crates/printer/src/lib.rs b/crates/printer/src/lib.rs index 04f4cf210..29e0a45b0 100644 --- a/crates/printer/src/lib.rs +++ b/crates/printer/src/lib.rs @@ -27,10 +27,6 @@ contain matches. This example shows how to create a "standard" printer and execute a search. ``` -extern crate grep_regex; -extern crate grep_printer; -extern crate grep_searcher; - use std::error::Error; use grep_regex::RegexMatcher; @@ -68,20 +64,6 @@ fn example() -> Result<(), Box> { #![deny(missing_docs)] -#[cfg(feature = "serde1")] -extern crate base64; - - - - - -#[cfg(feature = "serde1")] -#[macro_use] -extern crate serde_derive; -#[cfg(feature = "serde1")] -extern crate serde_json; - - pub use crate::color::{ default_color_specs, ColorError, ColorSpecs, UserColorSpec, }; diff --git a/crates/printer/src/stats.rs b/crates/printer/src/stats.rs index c06ab3fde..357b9a772 100644 --- a/crates/printer/src/stats.rs +++ b/crates/printer/src/stats.rs @@ -8,7 +8,7 @@ use crate::util::NiceDuration; /// When statistics are reported by a printer, they correspond to all searches /// executed with that printer. #[derive(Clone, Debug, Default, PartialEq, Eq)] -#[cfg_attr(feature = "serde1", derive(Serialize))] +#[cfg_attr(feature = "serde1", derive(serde::Serialize))] pub struct Stats { elapsed: NiceDuration, searches: u64, diff --git a/crates/regex/README.md b/crates/regex/README.md index bd51df77f..75029bfc0 100644 --- a/crates/regex/README.md +++ b/crates/regex/README.md @@ -26,9 +26,3 @@ Add this to your `Cargo.toml`: [dependencies] grep-regex = "0.1" ``` - -and this to your crate root: - -```rust -extern crate grep_regex; -``` diff --git a/crates/regex/src/lib.rs b/crates/regex/src/lib.rs index aae988091..e83b4361b 100644 --- a/crates/regex/src/lib.rs +++ b/crates/regex/src/lib.rs @@ -1,18 +1,8 @@ /*! An implementation of `grep-matcher`'s `Matcher` trait for Rust's regex engine. */ - #![deny(missing_docs)] - - - -#[macro_use] -extern crate log; - - - - pub use crate::error::{Error, ErrorKind}; pub use crate::matcher::{RegexCaptures, RegexMatcher, RegexMatcherBuilder}; diff --git a/crates/regex/src/literal.rs b/crates/regex/src/literal.rs index 7a6d92d9f..db5ed3b7c 100644 --- a/crates/regex/src/literal.rs +++ b/crates/regex/src/literal.rs @@ -55,7 +55,7 @@ impl LiteralSets { if !word { if self.prefixes.all_complete() && !self.prefixes.is_empty() { - debug!("literal prefixes detected: {:?}", self.prefixes); + log::debug!("literal prefixes detected: {:?}", self.prefixes); // When this is true, the regex engine will do a literal scan, // so we don't need to return anything. But we only do this // if we aren't doing a word regex, since a word regex adds @@ -106,7 +106,7 @@ impl LiteralSets { && !any_empty && !any_white { - debug!("required literals found: {:?}", req_lits); + log::debug!("required literals found: {:?}", req_lits); let alts: Vec = req_lits .into_iter() .map(|x| util::bytes_to_regex(x)) @@ -149,27 +149,27 @@ impl LiteralSets { let lits = match (p_min_len, s_min_len) { (None, None) => return None, (Some(_), None) => { - debug!("prefix literals found"); + log::debug!("prefix literals found"); self.prefixes.literals() } (None, Some(_)) => { - debug!("suffix literals found"); + log::debug!("suffix literals found"); self.suffixes.literals() } (Some(p), Some(s)) => { if p >= s { - debug!("prefix literals found"); + log::debug!("prefix literals found"); self.prefixes.literals() } else { - debug!("suffix literals found"); + log::debug!("suffix literals found"); self.suffixes.literals() } } }; - debug!("prefix/suffix literals found: {:?}", lits); + log::debug!("prefix/suffix literals found: {:?}", lits); if has_only_whitespace(lits) { - debug!("dropping literals because one was whitespace"); + log::debug!("dropping literals because one was whitespace"); return None; } let alts: Vec = @@ -177,9 +177,9 @@ impl LiteralSets { // We're matching raw bytes, so disable Unicode mode. Some(format!("(?-u:{})", alts.join("|"))) } else { - debug!("required literal found: {:?}", util::show_bytes(lit)); + log::debug!("required literal found: {:?}", util::show_bytes(lit)); if lit.chars().all(|c| c.is_whitespace()) { - debug!("dropping literal because one was whitespace"); + log::debug!("dropping literal because one was whitespace"); return None; } Some(format!("(?-u:{})", util::bytes_to_regex(&lit))) diff --git a/crates/regex/src/matcher.rs b/crates/regex/src/matcher.rs index cb7749c8c..92ef5c768 100644 --- a/crates/regex/src/matcher.rs +++ b/crates/regex/src/matcher.rs @@ -47,11 +47,11 @@ impl RegexMatcherBuilder { let fast_line_regex = chir.fast_line_regex()?; let non_matching_bytes = chir.non_matching_bytes(); if let Some(ref re) = fast_line_regex { - debug!("extracted fast line regex: {:?}", re); + log::debug!("extracted fast line regex: {:?}", re); } let matcher = RegexMatcherImpl::new(&chir)?; - trace!("final regex: {:?}", matcher.regex()); + log::trace!("final regex: {:?}", matcher.regex()); Ok(RegexMatcher { config: self.config.clone(), matcher, diff --git a/crates/regex/src/word.rs b/crates/regex/src/word.rs index 61b7e0f9e..d73dd6ca2 100644 --- a/crates/regex/src/word.rs +++ b/crates/regex/src/word.rs @@ -49,7 +49,7 @@ impl WordMatcher { expr.with_pattern(|pat| format!("^(?:{})$", pat))?.regex()?; let word_expr = expr.with_pattern(|pat| { let pat = format!(r"(?:(?m:^)|\W)({})(?:\W|(?m:$))", pat); - debug!("word regex: {:?}", pat); + log::debug!("word regex: {:?}", pat); pat })?; let regex = word_expr.regex()?; diff --git a/crates/searcher/README.md b/crates/searcher/README.md index 67a45a892..e62065564 100644 --- a/crates/searcher/README.md +++ b/crates/searcher/README.md @@ -28,9 +28,3 @@ Add this to your `Cargo.toml`: [dependencies] grep-searcher = "0.1" ``` - -and this to your crate root: - -```rust -extern crate grep_searcher; -``` diff --git a/crates/searcher/src/lib.rs b/crates/searcher/src/lib.rs index 49c7e2a4a..f6a96a213 100644 --- a/crates/searcher/src/lib.rs +++ b/crates/searcher/src/lib.rs @@ -48,10 +48,6 @@ using the implementation of `Sink`. ``` -extern crate grep_matcher; -extern crate grep_regex; -extern crate grep_searcher; - use std::error::Error; use grep_matcher::Matcher; @@ -99,9 +95,6 @@ searches stdin. #![deny(missing_docs)] -#[macro_use] -extern crate log; - pub use crate::lines::{LineIter, LineStep}; pub use crate::searcher::{ BinaryDetection, ConfigError, Encoding, MmapChoice, Searcher, diff --git a/crates/searcher/src/searcher/core.rs b/crates/searcher/src/searcher/core.rs index a6901314d..b6deda018 100644 --- a/crates/searcher/src/searcher/core.rs +++ b/crates/searcher/src/searcher/core.rs @@ -53,9 +53,9 @@ impl<'s, M: Matcher, S: Sink> Core<'s, M, S> { }; if !core.searcher.multi_line_with_matcher(&core.matcher) { if core.is_line_by_line_fast() { - trace!("searcher core: will use fast line searcher"); + log::trace!("searcher core: will use fast line searcher"); } else { - trace!("searcher core: will use slow line searcher"); + log::trace!("searcher core: will use slow line searcher"); } } core diff --git a/crates/searcher/src/searcher/mmap.rs b/crates/searcher/src/searcher/mmap.rs index 85e0487fb..0ab2d53f9 100644 --- a/crates/searcher/src/searcher/mmap.rs +++ b/crates/searcher/src/searcher/mmap.rs @@ -83,13 +83,13 @@ impl MmapChoice { Ok(mmap) => Some(mmap), Err(err) => { if let Some(path) = path { - debug!( + log::debug!( "{}: failed to open memory map: {}", path.display(), err ); } else { - debug!("failed to open memory map: {}", err); + log::debug!("failed to open memory map: {}", err); } None } diff --git a/crates/searcher/src/searcher/mod.rs b/crates/searcher/src/searcher/mod.rs index 5f9cc7604..3bd939bbe 100644 --- a/crates/searcher/src/searcher/mod.rs +++ b/crates/searcher/src/searcher/mod.rs @@ -659,16 +659,19 @@ impl Searcher { S: Sink, { if let Some(mmap) = self.config.mmap.open(file, path) { - trace!("{:?}: searching via memory map", path); + log::trace!("{:?}: searching via memory map", path); return self.search_slice(matcher, &mmap, write_to); } // Fast path for multi-line searches of files when memory maps are // not enabled. This pre-allocates a buffer roughly the size of the // file, which isn't possible when searching an arbitrary io::Read. if self.multi_line_with_matcher(&matcher) { - trace!("{:?}: reading entire file on to heap for mulitline", path); + log::trace!( + "{:?}: reading entire file on to heap for mulitline", + path + ); self.fill_multi_line_buffer_from_file::(file)?; - trace!("{:?}: searching via multiline strategy", path); + log::trace!("{:?}: searching via multiline strategy", path); MultiLine::new( self, matcher, @@ -677,7 +680,7 @@ impl Searcher { ) .run() } else { - trace!("{:?}: searching using generic reader", path); + log::trace!("{:?}: searching using generic reader", path); self.search_reader(matcher, file, write_to) } } @@ -713,9 +716,11 @@ impl Searcher { .map_err(S::Error::error_io)?; if self.multi_line_with_matcher(&matcher) { - trace!("generic reader: reading everything to heap for multiline"); + log::trace!( + "generic reader: reading everything to heap for multiline" + ); self.fill_multi_line_buffer_from_reader::<_, S>(decoder)?; - trace!("generic reader: searching via multiline strategy"); + log::trace!("generic reader: searching via multiline strategy"); MultiLine::new( self, matcher, @@ -726,7 +731,7 @@ impl Searcher { } else { let mut line_buffer = self.line_buffer.borrow_mut(); let rdr = LineBufferReader::new(decoder, &mut *line_buffer); - trace!("generic reader: searching via roll buffer strategy"); + log::trace!("generic reader: searching via roll buffer strategy"); ReadByLine::new(self, matcher, rdr, write_to).run() } } @@ -747,14 +752,16 @@ impl Searcher { // We can search the slice directly, unless we need to do transcoding. if self.slice_needs_transcoding(slice) { - trace!("slice reader: needs transcoding, using generic reader"); + log::trace!( + "slice reader: needs transcoding, using generic reader" + ); return self.search_reader(matcher, slice, write_to); } if self.multi_line_with_matcher(&matcher) { - trace!("slice reader: searching via multiline strategy"); + log::trace!("slice reader: searching via multiline strategy"); MultiLine::new(self, matcher, slice, write_to).run() } else { - trace!("slice reader: searching via slice-by-line strategy"); + log::trace!("slice reader: searching via slice-by-line strategy"); SliceByLine::new(self, matcher, slice, write_to).run() } }