summaryrefslogtreecommitdiffstats
path: root/crates/ignore
diff options
context:
space:
mode:
authorAndrew Gallant <jamslam@gmail.com>2021-06-01 20:45:45 -0400
committerAndrew Gallant <jamslam@gmail.com>2021-06-01 21:07:37 -0400
commite824531e387b96b43fd2c2d396c884c010eb13d4 (patch)
treeac6dc8dfa65f55daa72cac3e7cf7a6b763296041 /crates/ignore
parentaf54069c51cc3656c9c343a7fb3c9360cfddf505 (diff)
edition: manual changes
This is mostly just about removing 'extern crate' everywhere and fixing the fallout.
Diffstat (limited to 'crates/ignore')
-rw-r--r--crates/ignore/README.md6
-rw-r--r--crates/ignore/examples/walk.rs6
-rw-r--r--crates/ignore/src/dir.rs2
-rw-r--r--crates/ignore/src/gitignore.rs2
-rw-r--r--crates/ignore/src/lib.rs13
-rw-r--r--crates/ignore/src/types.rs2
-rw-r--r--crates/ignore/src/walk.rs6
7 files changed, 7 insertions, 30 deletions
diff --git a/crates/ignore/README.md b/crates/ignore/README.md
index d9213ec6..72258e6b 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 969bd1cb..e064478c 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::<DirEntry>(100);
+ let (tx, rx) = crossbeam_channel::bounded::<DirEntry>(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 18ab9abf..09414e9a 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 6eea9c4a..7922651c 100644
--- a/crates/ignore/src/gitignore.rs
+++ b/crates/ignore/src/gitignore.rs
@@ -592,7 +592,7 @@ fn parse_excludes_file(data: &[u8]) -> Option<PathBuf> {
// 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 3c82231d..824f7c4d 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 62275b40..efb9a8d9 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 fac8c279..b381197e 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