diff options
author | Andrew Gallant <jamslam@gmail.com> | 2021-06-01 19:29:50 -0400 |
---|---|---|
committer | Andrew Gallant <jamslam@gmail.com> | 2021-06-01 21:07:37 -0400 |
commit | 459a9c563706ef84b8710fab8727b770552ed29c (patch) | |
tree | 773d47a7018b2c865c6c0048cb6aec42e26ea8d6 | |
parent | e4c4540f6a21d2cbb335432aa19fc43f4906e273 (diff) |
edition: initial 'cargo fix --edition' run
40 files changed, 127 insertions, 125 deletions
diff --git a/crates/cli/src/decompress.rs b/crates/cli/src/decompress.rs index 9bd9100a..f9637acc 100644 --- a/crates/cli/src/decompress.rs +++ b/crates/cli/src/decompress.rs @@ -6,7 +6,7 @@ use std::process::Command; use globset::{Glob, GlobSet, GlobSetBuilder}; -use process::{CommandError, CommandReader, CommandReaderBuilder}; +use crate::process::{CommandError, CommandReader, CommandReaderBuilder}; /// A builder for a matcher that determines which files get decompressed. #[derive(Clone, Debug)] diff --git a/crates/cli/src/lib.rs b/crates/cli/src/lib.rs index 5453ccce..059f42c4 100644 --- a/crates/cli/src/lib.rs +++ b/crates/cli/src/lib.rs @@ -178,18 +178,18 @@ mod pattern; mod process; mod wtr; -pub use decompress::{ +pub use crate::decompress::{ resolve_binary, DecompressionMatcher, DecompressionMatcherBuilder, DecompressionReader, DecompressionReaderBuilder, }; -pub use escape::{escape, escape_os, unescape, unescape_os}; -pub use human::{parse_human_readable_size, ParseSizeError}; -pub use pattern::{ +pub use crate::escape::{escape, escape_os, unescape, unescape_os}; +pub use crate::human::{parse_human_readable_size, ParseSizeError}; +pub use crate::pattern::{ pattern_from_bytes, pattern_from_os, patterns_from_path, patterns_from_reader, patterns_from_stdin, InvalidPatternError, }; -pub use process::{CommandError, CommandReader, CommandReaderBuilder}; -pub use wtr::{ +pub use crate::process::{CommandError, CommandReader, CommandReaderBuilder}; +pub use crate::wtr::{ stdout, stdout_buffered_block, stdout_buffered_line, StandardStream, }; diff --git a/crates/cli/src/pattern.rs b/crates/cli/src/pattern.rs index 11e4a8b4..c59f2801 100644 --- a/crates/cli/src/pattern.rs +++ b/crates/cli/src/pattern.rs @@ -8,7 +8,7 @@ use std::str; use bstr::io::BufReadExt; -use escape::{escape, escape_os}; +use crate::escape::{escape, escape_os}; /// An error that occurs when a pattern could not be converted to valid UTF-8. /// diff --git a/crates/cli/src/process.rs b/crates/cli/src/process.rs index 8ce94f15..42224a92 100644 --- a/crates/cli/src/process.rs +++ b/crates/cli/src/process.rs @@ -116,7 +116,7 @@ impl CommandReaderBuilder { .stderr(process::Stdio::piped()) .spawn()?; let stderr = if self.async_stderr { - StderrReader::async(child.stderr.take().unwrap()) + StderrReader::r#async(child.stderr.take().unwrap()) } else { StderrReader::sync(child.stderr.take().unwrap()) }; @@ -285,7 +285,7 @@ enum StderrReader { impl StderrReader { /// Create a reader for stderr that reads contents asynchronously. - fn async(mut stderr: process::ChildStderr) -> StderrReader { + fn r#async(mut stderr: process::ChildStderr) -> StderrReader { let handle = thread::spawn(move || stderr_to_command_error(&mut stderr)); StderrReader::Async(Some(handle)) diff --git a/crates/cli/src/wtr.rs b/crates/cli/src/wtr.rs index f7722ce8..b4890364 100644 --- a/crates/cli/src/wtr.rs +++ b/crates/cli/src/wtr.rs @@ -2,7 +2,7 @@ use std::io; use termcolor; -use is_tty_stdout; +use crate::is_tty_stdout; /// A writer that supports coloring with either line or block buffering. pub struct StandardStream(StandardStreamKind); diff --git a/crates/globset/src/glob.rs b/crates/globset/src/glob.rs index 1f8009d2..ce7dc665 100644 --- a/crates/globset/src/glob.rs +++ b/crates/globset/src/glob.rs @@ -8,7 +8,7 @@ use std::str; use regex; use regex::bytes::Regex; -use {new_regex, Candidate, Error, ErrorKind}; +use crate::{new_regex, Candidate, Error, ErrorKind}; /// Describes a matching strategy for a particular pattern. /// @@ -1015,7 +1015,7 @@ fn ends_with(needle: &[u8], haystack: &[u8]) -> bool { mod tests { use super::Token::*; use super::{Glob, GlobBuilder, Token}; - use {ErrorKind, GlobSetBuilder}; + use crate::{ErrorKind, GlobSetBuilder}; #[derive(Clone, Copy, Debug, Default)] struct Options { diff --git a/crates/globset/src/lib.rs b/crates/globset/src/lib.rs index 52700bec..8831dc75 100644 --- a/crates/globset/src/lib.rs +++ b/crates/globset/src/lib.rs @@ -125,9 +125,9 @@ use aho_corasick::AhoCorasick; use bstr::{ByteSlice, ByteVec, B}; use regex::bytes::{Regex, RegexBuilder, RegexSet}; -use glob::MatchStrategy; -pub use glob::{Glob, GlobBuilder, GlobMatcher}; -use pathutil::{file_name, file_name_ext, normalize_path}; +use crate::glob::MatchStrategy; +pub use crate::glob::{Glob, GlobBuilder, GlobMatcher}; +use crate::pathutil::{file_name, file_name_ext, normalize_path}; mod glob; mod pathutil; @@ -841,7 +841,7 @@ impl RequiredExtensionStrategyBuilder { #[cfg(test)] mod tests { use super::{GlobSet, GlobSetBuilder}; - use glob::Glob; + use crate::glob::Glob; #[test] fn set_works() { diff --git a/crates/ignore/src/dir.rs b/crates/ignore/src/dir.rs index 296c8034..7a77aad4 100644 --- a/crates/ignore/src/dir.rs +++ b/crates/ignore/src/dir.rs @@ -20,12 +20,12 @@ use std::io::{self, BufRead}; use std::path::{Path, PathBuf}; use std::sync::{Arc, RwLock}; -use gitignore::{self, Gitignore, GitignoreBuilder}; -use overrides::{self, Override}; -use pathutil::{is_hidden, strip_prefix}; -use types::{self, Types}; -use walk::DirEntry; -use {Error, Match, PartialErrorBuilder}; +use crate::gitignore::{self, Gitignore, GitignoreBuilder}; +use crate::overrides::{self, Override}; +use crate::pathutil::{is_hidden, strip_prefix}; +use crate::types::{self, Types}; +use crate::walk::DirEntry; +use crate::{Error, Match, PartialErrorBuilder}; /// IgnoreMatch represents information about where a match came from when using /// the `Ignore` matcher. @@ -840,10 +840,10 @@ mod tests { use std::io::Write; use std::path::Path; - use dir::IgnoreBuilder; - use gitignore::Gitignore; - use tests::TempDir; - use Error; + use crate::dir::IgnoreBuilder; + use crate::gitignore::Gitignore; + use crate::tests::TempDir; + use crate::Error; fn wfile<P: AsRef<Path>>(path: P, contents: &str) { let mut file = File::create(path).unwrap(); diff --git a/crates/ignore/src/gitignore.rs b/crates/ignore/src/gitignore.rs index 2b8844b9..6eea9c4a 100644 --- a/crates/ignore/src/gitignore.rs +++ b/crates/ignore/src/gitignore.rs @@ -19,8 +19,8 @@ use globset::{Candidate, GlobBuilder, GlobSet, GlobSetBuilder}; use regex::bytes::Regex; use thread_local::ThreadLocal; -use pathutil::{is_file_name, strip_prefix}; -use {Error, Match, PartialErrorBuilder}; +use crate::pathutil::{is_file_name, strip_prefix}; +use crate::{Error, Match, PartialErrorBuilder}; /// Glob represents a single glob in a gitignore file. /// diff --git a/crates/ignore/src/lib.rs b/crates/ignore/src/lib.rs index e58fa36a..64b2a8bd 100644 --- a/crates/ignore/src/lib.rs +++ b/crates/ignore/src/lib.rs @@ -64,7 +64,7 @@ use std::fmt; use std::io; use std::path::{Path, PathBuf}; -pub use walk::{ +pub use crate::walk::{ DirEntry, ParallelVisitor, ParallelVisitorBuilder, Walk, WalkBuilder, WalkParallel, WalkState, }; diff --git a/crates/ignore/src/overrides.rs b/crates/ignore/src/overrides.rs index 7c03fbf5..d42d67ca 100644 --- a/crates/ignore/src/overrides.rs +++ b/crates/ignore/src/overrides.rs @@ -6,8 +6,8 @@ line tools. use std::path::Path; -use gitignore::{self, Gitignore, GitignoreBuilder}; -use {Error, Match}; +use crate::gitignore::{self, Gitignore, GitignoreBuilder}; +use crate::{Error, Match}; /// Glob represents a single glob in an override matcher. /// diff --git a/crates/ignore/src/pathutil.rs b/crates/ignore/src/pathutil.rs index 210d1ecb..f21b4f5a 100644 --- a/crates/ignore/src/pathutil.rs +++ b/crates/ignore/src/pathutil.rs @@ -1,7 +1,7 @@ use std::ffi::OsStr; use std::path::Path; -use walk::DirEntry; +use crate::walk::DirEntry; /// Returns true if and only if this entry is considered to be hidden. /// diff --git a/crates/ignore/src/types.rs b/crates/ignore/src/types.rs index 4edf56de..62275b40 100644 --- a/crates/ignore/src/types.rs +++ b/crates/ignore/src/types.rs @@ -93,9 +93,9 @@ use globset::{GlobBuilder, GlobSet, GlobSetBuilder}; use regex::Regex; use thread_local::ThreadLocal; -use default_types::DEFAULT_TYPES; -use pathutil::file_name; -use {Error, Match}; +use crate::default_types::DEFAULT_TYPES; +use crate::pathutil::file_name; +use crate::{Error, Match}; /// Glob represents a single glob in a set of file type definitions. /// diff --git a/crates/ignore/src/walk.rs b/crates/ignore/src/walk.rs index 4d4054a9..2ce66a14 100644 --- a/crates/ignore/src/walk.rs +++ b/crates/ignore/src/walk.rs @@ -13,11 +13,11 @@ use std::vec; use same_file::Handle; use walkdir::{self, WalkDir}; -use dir::{Ignore, IgnoreBuilder}; -use gitignore::GitignoreBuilder; -use overrides::Override; -use types::Types; -use {Error, PartialErrorBuilder}; +use crate::dir::{Ignore, IgnoreBuilder}; +use crate::gitignore::GitignoreBuilder; +use crate::overrides::Override; +use crate::types::Types; +use crate::{Error, PartialErrorBuilder}; /// A directory entry with a possible error attached. /// @@ -1852,7 +1852,7 @@ mod tests { use std::sync::{Arc, Mutex}; use super::{DirEntry, WalkBuilder, WalkState}; - use tests::TempDir; + use crate::tests::TempDir; fn wfile<P: AsRef<Path>>(path: P, contents: &str) { let mut file = File::create(path).unwrap(); diff --git a/crates/matcher/src/lib.rs b/crates/matcher/src/lib.rs index 4859de39..947eb019 100644 --- a/crates/matcher/src/lib.rs +++ b/crates/matcher/src/lib.rs @@ -45,7 +45,7 @@ use std::io; use std::ops; use std::u64; -use interpolate::interpolate; +use crate::interpolate::interpolate; mod interpolate; diff --git a/crates/matcher/tests/test_matcher.rs b/crates/matcher/tests/test_matcher.rs index b550df6b..ebfb8be2 100644 --- a/crates/matcher/tests/test_matcher.rs +++ b/crates/matcher/tests/test_matcher.rs @@ -1,7 +1,7 @@ use grep_matcher::{Captures, Match, Matcher}; use regex::bytes::Regex; -use util::{RegexMatcher, RegexMatcherNoCaps}; +use crate::util::{RegexMatcher, RegexMatcherNoCaps}; fn matcher(pattern: &str) -> RegexMatcher { RegexMatcher::new(Regex::new(pattern).unwrap()) diff --git a/crates/pcre2/src/lib.rs b/crates/pcre2/src/lib.rs index d7cb0156..37fa04fc 100644 --- a/crates/pcre2/src/lib.rs +++ b/crates/pcre2/src/lib.rs @@ -8,8 +8,8 @@ An implementation of `grep-matcher`'s `Matcher` trait for extern crate grep_matcher; extern crate pcre2; -pub use error::{Error, ErrorKind}; -pub use matcher::{RegexCaptures, RegexMatcher, RegexMatcherBuilder}; +pub use crate::error::{Error, ErrorKind}; +pub use crate::matcher::{RegexCaptures, RegexMatcher, RegexMatcherBuilder}; pub use pcre2::{is_jit_available, version}; mod error; diff --git a/crates/pcre2/src/matcher.rs b/crates/pcre2/src/matcher.rs index a921c91b..94a6f338 100644 --- a/crates/pcre2/src/matcher.rs +++ b/crates/pcre2/src/matcher.rs @@ -3,7 +3,7 @@ use std::collections::HashMap; use grep_matcher::{Captures, Match, Matcher}; use pcre2::bytes::{CaptureLocations, Regex, RegexBuilder}; -use error::Error; +use crate::error::Error; /// A builder for configuring the compilation of a PCRE2 regex. #[derive(Clone, Debug)] diff --git a/crates/printer/src/json.rs b/crates/printer/src/json.rs index 8500e6a1..5cf3229a 100644 --- a/crates/printer/src/json.rs +++ b/crates/printer/src/json.rs @@ -8,10 +8,10 @@ use grep_searcher::{ }; use serde_json as json; -use counter::CounterWriter; -use jsont; -use stats::Stats; -use util::find_iter_at_in_context; +use crate::counter::CounterWriter; +use crate::jsont; +use crate::stats::Stats; +use crate::util::find_iter_at_in_context; /// The configuration for the JSON printer. /// diff --git a/crates/printer/src/jsont.rs b/crates/printer/src/jsont.rs index f4244747..878d9691 100644 --- a/crates/printer/src/jsont.rs +++ b/crates/printer/src/jsont.rs @@ -13,7 +13,7 @@ use std::str; use base64; use serde::{Serialize, Serializer}; -use stats::Stats; +use crate::stats::Stats; #[derive(Serialize)] #[serde(tag = "type", content = "data")] diff --git a/crates/printer/src/lib.rs b/crates/printer/src/lib.rs index abb1087f..86515ebf 100644 --- a/crates/printer/src/lib.rs +++ b/crates/printer/src/lib.rs @@ -84,13 +84,15 @@ extern crate serde_derive; extern crate serde_json; extern crate termcolor; -pub use color::{default_color_specs, ColorError, ColorSpecs, UserColorSpec}; +pub use crate::color::{ + default_color_specs, ColorError, ColorSpecs, UserColorSpec, +}; #[cfg(feature = "serde1")] -pub use json::{JSONBuilder, JSONSink, JSON}; -pub use standard::{Standard, StandardBuilder, StandardSink}; -pub use stats::Stats; -pub use summary::{Summary, SummaryBuilder, SummaryKind, SummarySink}; -pub use util::PrinterPath; +pub use crate::json::{JSONBuilder, JSONSink, JSON}; +pub use crate::standard::{Standard, StandardBuilder, StandardSink}; +pub use crate::stats::Stats; +pub use crate::summary::{Summary, SummaryBuilder, SummaryKind, SummarySink}; +pub use crate::util::PrinterPath; // The maximum number of bytes to execute a search to account for look-ahead. // diff --git a/crates/printer/src/standard.rs b/crates/printer/src/standard.rs index c4675e43..5ff84bb1 100644 --- a/crates/printer/src/standard.rs +++ b/crates/printer/src/standard.rs @@ -13,10 +13,10 @@ use grep_searcher::{ }; use termcolor::{ColorSpec, NoColor, WriteColor}; -use color::ColorSpecs; -use counter::CounterWriter; -use stats::Stats; -use util::{ +use crate::color::ColorSpecs; +use crate::counter::CounterWriter; +use crate::stats::Stats; +use crate::util::{ find_iter_at_in_context, trim_ascii_prefix, trim_line_terminator, PrinterPath, Replacer, Sunk, }; diff --git a/crates/printer/src/stats.rs b/crates/printer/src/stats.rs index 0fd723a1..c06ab3fd 100644 --- a/crates/printer/src/stats.rs +++ b/crates/printer/src/stats.rs @@ -1,7 +1,7 @@ use std::ops::{Add, AddAssign}; use std::time::Duration; -use util::NiceDuration; +use crate::util::NiceDuration; /// Summary statistics produced at the end of a search. /// diff --git a/crates/printer/src/summary.rs b/crates/printer/src/summary.rs index e062662d..a1ba0be3 100644 --- a/crates/printer/src/summary.rs +++ b/crates/printer/src/summary.rs @@ -8,10 +8,10 @@ use grep_matcher::Matcher; use grep_searcher::{Searcher, Sink, SinkError, SinkFinish, SinkMatch}; use termcolor::{ColorSpec, NoColor, WriteColor}; -use color::ColorSpecs; -use counter::CounterWriter; -use stats::Stats; -use util::{find_iter_at_in_context, PrinterPath}; +use crate::color::ColorSpecs; +use crate::counter::CounterWriter; +use crate::stats::Stats; +use crate::util::{find_iter_at_in_context, PrinterPath}; /// The configuration for the summary printer. /// diff --git a/crates/printer/src/util.rs b/crates/printer/src/util.rs index 68693d34..e9129065 100644 --- a/crates/printer/src/util.rs +++ b/crates/printer/src/util.rs @@ -12,7 +12,7 @@ use grep_searcher::{ #[cfg(feature = "serde1")] use serde::{Serialize, Serializer}; -use MAX_LOOK_AHEAD; +use crate::MAX_LOOK_AHEAD; /// A type for handling replacements while amortizing allocation. pub struct Replacer<M: Matcher> { diff --git a/crates/regex/src/config.rs b/crates/regex/src/config.rs index 6d2813ae..4f3cc0fd 100644 --- a/crates/regex/src/config.rs +++ b/crates/regex/src/config.rs @@ -3,13 +3,13 @@ use regex::bytes::{Regex, RegexBuilder}; use regex_syntax::ast::{self, Ast}; use regex_syntax::hir::{self, Hir}; -use ast::AstAnalysis; -use crlf::crlfify; -use error::Error; -use literal::LiteralSets; -use multi::alternation_literals; -use non_matching::non_matching_bytes; -use strip::strip_from_match; +use crate::ast::AstAnalysis; +use crate::crlf::crlfify; +use crate::error::Error; +use crate::literal::LiteralSets; +use crate::multi::alternation_literals; +use crate::non_matching::non_matching_bytes; +use crate::strip::strip_from_match; /// Config represents the configuration of a regex matcher in this crate. /// The configuration is itself a rough combination of the knobs found in diff --git a/crates/regex/src/crlf.rs b/crates/regex/src/crlf.rs index 09e78b9f..45492bdb 100644 --- a/crates/regex/src/crlf.rs +++ b/crates/regex/src/crlf.rs @@ -4,9 +4,9 @@ use grep_matcher::{Match, Matcher, NoError}; use regex::bytes::Regex; use regex_syntax::hir::{self, Hir, HirKind}; -use config::ConfiguredHIR; -use error::Error; -use matcher::RegexCaptures; +use crate::config::ConfiguredHIR; +use crate::error::Error; +use crate::matcher::RegexCaptures; /// A matcher for implementing "word match" semantics. #[derive(Clone, Debug)] diff --git a/crates/regex/src/error.rs b/crates/regex/src/error.rs index f3bf0825..6eba85ac 100644 --- a/crates/regex/src/error.rs +++ b/crates/regex/src/error.rs @@ -1,7 +1,7 @@ use std::error; use std::fmt; -use util; +use crate::util; /// An error that can occur in this crate. /// diff --git a/crates/regex/src/lib.rs b/crates/regex/src/lib.rs index 4004a692..36efa858 100644 --- a/crates/regex/src/lib.rs +++ b/crates/regex/src/lib.rs @@ -13,8 +13,8 @@ extern crate regex; extern crate regex_syntax; extern crate thread_local; -pub use error::{Error, ErrorKind}; -pub use matcher::{RegexCaptures, RegexMatcher, RegexMatcherBuilder}; +pub use crate::error::{Error, ErrorKind}; +pub use crate::matcher::{RegexCaptures, RegexMatcher, RegexMatcherBuilder}; mod ast; mod config; diff --git a/crates/regex/src/literal.rs b/crates/regex/src/literal.rs index 1828760e..7a6d92d9 100644 --- a/crates/regex/src/literal.rs +++ b/crates/regex/src/literal.rs @@ -9,7 +9,7 @@ use bstr::ByteSlice; use regex_syntax::hir::literal::{Literal, Literals}; use regex_syntax::hir::{self, Hir, HirKind}; -use util; +use crate::util; /// Represents prefix, suffix and inner "required" literals for a regular /// expression. diff --git a/crates/regex/src/matcher.rs b/crates/regex/src/matcher.rs index 3511e75b..cb7749c8 100644 --- a/crates/regex/src/matcher.rs +++ b/crates/regex/src/matcher.rs @@ -5,11 +5,11 @@ use grep_matcher::{ }; use regex::bytes::{CaptureLocations, Regex}; -use config::{Config, ConfiguredHIR}; -use crlf::CRLFMatcher; -use error::Error; -use multi::MultiLiteralMatcher; -use word::WordMatcher; +use crate::config::{Config, ConfiguredHIR}; +use crate::crlf::CRLFMatcher; +use crate::error::Error; +use crate::multi::MultiLiteralMatcher; +use crate::word::WordMatcher; /// A builder for constructing a `Matcher` using regular expressions. /// diff --git a/crates/regex/src/multi.rs b/crates/regex/src/multi.rs index ef4e62c2..d2d4af93 100644 --- a/crates/regex/src/multi.rs +++ b/crates/regex/src/multi.rs @@ -2,8 +2,8 @@ use aho_corasick::{AhoCorasick, AhoCorasickBuilder, MatchKind}; use grep_matcher::{Match, Matcher, NoError}; use regex_syntax::hir::Hir; -use error::Error; -use matcher::RegexCaptures; +use crate::error::Error; +use crate::matcher::RegexCaptures; /// A matcher for an alternation of literals. /// diff --git a/crates/regex/src/strip.rs b/crates/regex/src/strip.rs index 5322e5c9..f529f47c 100644 --- a/crates/regex/src/strip.rs +++ b/crates/regex/src/strip.rs @@ -1,7 +1,7 @@ use grep_matcher::LineTerminator; use regex_syntax::hir::{self, Hir, HirKind}; -use error::{Error, ErrorKind}; +use crate::error::{Error, ErrorKind}; /// Return an HIR that is guaranteed to never match the given line terminator, /// if possible. @@ -106,7 +106,7 @@ mod tests { use regex_syntax::Parser; use super::{strip_from_match, LineTerminator}; - use error::Error; + use crate::error::Error; fn roundtrip(pattern: &str, byte: u8) -> String { roundtrip_line_term(pattern, LineTerminator::byte(byte)).unwrap() diff --git a/crates/regex/src/word.rs b/crates/regex/src/word.rs index 1a75ba48..61b7e0f9 100644 --- a/crates/regex/src/word.rs +++ b/crates/regex/src/word.rs @@ -6,9 +6,9 @@ use grep_matcher::{Match, Matcher, NoError}; use regex::bytes::{CaptureLocations, Regex}; use thread_local::ThreadLocal; -use config::ConfiguredHIR; -use error::Error; -use matcher::RegexCaptures; +use crate::config::ConfiguredHIR; +use crate::error::Error; +use crate::matcher::RegexCaptures; /// A matcher for implementing "word match" semantics. #[derive(Debug)] @@ -184,7 +184,7 @@ impl Matcher for WordMatcher { #[cfg(test)] mod tests { use super::WordMatcher; - use config::Config; + use crate::config::Config; use grep_matcher::{Captures, Match, Matcher}; fn matcher(pattern: &str) -> WordMatcher { |