diff --git a/Cargo.lock b/Cargo.lock index 554fcbdf..ee073bce 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -82,24 +82,24 @@ dependencies = [ [[package]] name = "crossbeam-channel" -version = "0.2.4" +version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "crossbeam-epoch 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", - "crossbeam-utils 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", - "parking_lot 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)", - "rand 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)", + "crossbeam-epoch 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", + "crossbeam-utils 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)", + "parking_lot 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", "smallvec 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "crossbeam-epoch" -version = "0.5.2" +version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "arrayvec 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)", "cfg-if 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", - "crossbeam-utils 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "crossbeam-utils 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "memoffset 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "scopeguard 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", @@ -107,8 +107,11 @@ dependencies = [ [[package]] name = "crossbeam-utils" -version = "0.5.0" +version = "0.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "cfg-if 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", +] [[package]] name = "encoding_rs" @@ -255,14 +258,14 @@ dependencies = [ name = "ignore" version = "0.4.4" dependencies = [ - "crossbeam-channel 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", + "crossbeam-channel 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", "globset 0.4.2", "lazy_static 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", "memchr 2.0.2 (registry+https://github.com/rust-lang/crates.io-index)", "regex 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "same-file 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", - "tempdir 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", + "tempfile 3.0.5 (registry+https://github.com/rust-lang/crates.io-index)", "thread_local 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", "walkdir 2.2.5 (registry+https://github.com/rust-lang/crates.io-index)", "winapi-util 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -348,20 +351,21 @@ dependencies = [ [[package]] name = "parking_lot" -version = "0.6.4" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "lock_api 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", - "parking_lot_core 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "parking_lot_core 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "parking_lot_core" -version = "0.3.0" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", - "rand 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", "smallvec 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -410,30 +414,68 @@ dependencies = [ [[package]] name = "rand" -version = "0.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "fuchsia-zircon 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "rand" -version = "0.5.5" +version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)", "fuchsia-zircon 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", - "rand_core 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_chacha 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_core 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_hc 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_isaac 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_pcg 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", + "rand_xorshift 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] -name = "rand_core" -version = "0.2.1" +name = "rand_chacha" +version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "rand_core 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "rand_core" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[[package]] +name = "rand_hc" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "rand_core 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "rand_isaac" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "rand_core 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "rand_pcg" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "rand_core 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "rand_xorshift" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "rand_core 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", +] [[package]] name = "redox_syscall" @@ -493,6 +535,14 @@ dependencies = [ "termcolor 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "rustc_version" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "ryu" version = "0.2.6" @@ -516,6 +566,19 @@ name = "scopeguard" version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" +[[package]] +name = "semver" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "semver-parser" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" + [[package]] name = "serde" version = "1.0.77" @@ -575,12 +638,16 @@ dependencies = [ ] [[package]] -name = "tempdir" -version = "0.3.7" +name = "tempfile" +version = "3.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "rand 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", + "redox_syscall 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)", "remove_dir_all 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -713,9 +780,9 @@ dependencies = [ "checksum cfg-if 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "0c4e7bb64a8ebb0d856483e1e682ea3422f883c5f5615a90d51a2c82fe87fdd3" "checksum clap 2.32.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b957d88f4b6a63b9d70d5f454ac8011819c6efa7727858f458ab71c756ce2d3e" "checksum cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f" -"checksum crossbeam-channel 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)" = "6c0a94250b0278d7fc5a894c3d276b11ea164edc8bf8feb10ca1ea517b44a649" -"checksum crossbeam-epoch 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "30fecfcac6abfef8771151f8be4abc9e4edc112c2bcb233314cafde2680536e9" -"checksum crossbeam-utils 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "677d453a17e8bd2b913fa38e8b9cf04bcdbb5be790aa294f2389661d72036015" +"checksum crossbeam-channel 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "8b7d034925ce9668a9a19539a82a2ae75660fa65c1a3a5ddbfce333aafcceb55" +"checksum crossbeam-epoch 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2449aaa4ec7ef96e5fb24db16024b935df718e9ae1cec0a1e68feeca2efca7b8" +"checksum crossbeam-utils 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)" = "41ee4864f4797060e52044376f7d107429ce1fb43460021b126424b7180ee21a" "checksum encoding_rs 0.8.10 (registry+https://github.com/rust-lang/crates.io-index)" = "065f4d0c826fdaef059ac45487169d918558e3cf86c9d89f6e81cf52369126e5" "checksum encoding_rs_io 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "098f6a0ab73a9ba256b71344dc82c6d7e252736ad9db7f4e35345f3a1f8713f5" "checksum fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "2fad85553e09a6f881f739c29f0b00b0f01357c743266d478b68951ce23285f3" @@ -733,25 +800,32 @@ dependencies = [ "checksum nodrop 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)" = "9a2228dca57108069a5262f2ed8bd2e82496d2e074a06d1ccc7ce1687b6ae0a2" "checksum num_cpus 1.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c51a3322e4bca9d212ad9a158a02abc6934d005490c054a2778df73a70aa0a30" "checksum owning_ref 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "cdf84f41639e037b484f93433aa3897863b561ed65c6e59c7073d7c561710f37" -"checksum parking_lot 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)" = "f0802bff09003b291ba756dc7e79313e51cc31667e94afbe847def490424cde5" -"checksum parking_lot_core 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "06a2b6aae052309c2fd2161ef58f5067bc17bb758377a0de9d4b279d603fdd8a" +"checksum parking_lot 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9723236a9525c757d9725b993511e3fc941e33f27751942232f0058298297edf" +"checksum parking_lot_core 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "94c8c7923936b28d546dfd14d4472eaf34c99b14e1c973a32b3e6d4eb04298c9" "checksum pcre2 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "3ae0a2682105ec5ca0ee5910bbc7e926386d348a05166348f74007942983c319" "checksum pcre2-sys 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "a9027f9474e4e13d3b965538aafcaebe48c803488ad76b3c97ef061a8324695f" "checksum pkg-config 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)" = "676e8eb2b1b4c9043511a9b7bea0915320d7e502b0a079fb03f9635a5252b18c" "checksum proc-macro2 0.4.18 (registry+https://github.com/rust-lang/crates.io-index)" = "afa4d377067cc02eb5e0b491d3f7cfbe145ad4da778535bfb13c444413dd35b9" "checksum quote 0.6.8 (registry+https://github.com/rust-lang/crates.io-index)" = "dd636425967c33af890042c483632d33fa7a18f19ad1d7ea72e8998c6ef8dea5" -"checksum rand 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "8356f47b32624fef5b3301c1be97e5944ecdd595409cc5da11d05f211db6cfbd" -"checksum rand 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)" = "e464cd887e869cddcae8792a4ee31d23c7edd516700695608f5b98c67ee0131c" -"checksum rand_core 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "edecf0f94da5551fc9b492093e30b041a891657db7940ee221f9d2f66e82eef2" +"checksum rand 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ae9d223d52ae411a33cf7e54ec6034ec165df296ccd23533d671a28252b6f66a" +"checksum rand_chacha 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "771b009e3a508cb67e8823dda454aaa5368c7bc1c16829fb77d3e980440dd34a" +"checksum rand_core 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "0905b6b7079ec73b314d4c748701f6931eb79fd97c668caa3f1899b22b32c6db" +"checksum rand_hc 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7b40677c7be09ae76218dc623efbf7b18e34bced3f38883af07bb75630a21bc4" +"checksum rand_isaac 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ded997c9d5f13925be2a6fd7e66bf1872597f759fd9dd93513dd7e92e5a5ee08" +"checksum rand_pcg 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "086bd09a33c7044e56bb44d5bdde5a60e7f119a9e95b0775f545de759a32fe05" +"checksum rand_xorshift 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "effa3fcaa47e18db002bdde6060944b6d2f9cfd8db471c30e873448ad9187be3" "checksum redox_syscall 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)" = "c214e91d3ecf43e9a4e41e578973adeb14b474f2bee858742d127af75a0112b1" "checksum redox_termios 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7e891cfe48e9100a70a3b6eb652fef28920c117d366339687bd5576160db0f76" "checksum regex 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "37e7cbbd370869ce2e8dff25c7018702d10b21a20ef7135316f8daecd6c25b7f" "checksum regex-syntax 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)" = "4e47a2ed29da7a9e1960e1639e7a982e6edc6d49be308a3b02daf511504a16d1" "checksum remove_dir_all 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "3488ba1b9a2084d38645c4c08276a1752dcbf2c7130d74f1569681ad5d2799c5" +"checksum rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a" "checksum ryu 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "7153dd96dade874ab973e098cb62fcdbb89a03682e46b144fd09550998d4a4a7" "checksum safemem 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e27a8b19b835f7aea908818e871f5cc3a5a186550c30773be987e155e8163d8f" "checksum same-file 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "10f7794e2fda7f594866840e95f5c5962e886e228e68b6505885811a94dd728c" "checksum scopeguard 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "94258f53601af11e6a49f722422f6e3425c52b06245a5cf9bc09908b174f5e27" +"checksum semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403" +"checksum semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" "checksum serde 1.0.77 (registry+https://github.com/rust-lang/crates.io-index)" = "c6e67977d7523ce4d9284ed58918af99392de8edb6192c44afefcf634654ab7f" "checksum serde_derive 1.0.77 (registry+https://github.com/rust-lang/crates.io-index)" = "5569c52faae3e21b9abae2cc5cfbb56ed008bfcac480ad62bc241b828f0b0aee" "checksum serde_json 1.0.27 (registry+https://github.com/rust-lang/crates.io-index)" = "59790990c5115d16027f00913e2e66de23a51f70422e549d2ad68c8c5f268f1c" @@ -760,7 +834,7 @@ dependencies = [ "checksum stable_deref_trait 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "dba1a27d3efae4351c8051072d619e3ade2820635c3958d826bfea39d59b54c8" "checksum strsim 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bb4f380125926a99e52bc279241539c018323fab05ad6368b56f93d9369ff550" "checksum syn 0.15.1 (registry+https://github.com/rust-lang/crates.io-index)" = "85fb2f7f9b7a4c8df2c913a852de570efdb40f0d2edd39c8245ad573f5c7fbcc" -"checksum tempdir 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)" = "15f2b5fb00ccdf689e0149d1b1b3c03fead81c2b37735d812fa8bddbbf41b6d8" +"checksum tempfile 3.0.5 (registry+https://github.com/rust-lang/crates.io-index)" = "7e91405c14320e5c79b3d148e1c86f40749a36e490642202a31689cb1a3452b2" "checksum termcolor 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "ff3bac0e465b59f194e7037ed404b0326e56ff234d767edc4c5cc9cd49e7a2c7" "checksum termion 1.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "689a3bdfaab439fd92bc87df5c4c78417d3cbe537487274e9b0b2dce76e92096" "checksum textwrap 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "307686869c93e71f94da64286f9a9524c0f308a9e1c87a583de8e9c9039ad3f6" diff --git a/ignore/Cargo.toml b/ignore/Cargo.toml index 164a8518..f2c8cf4d 100644 --- a/ignore/Cargo.toml +++ b/ignore/Cargo.toml @@ -18,7 +18,7 @@ name = "ignore" bench = false [dependencies] -crossbeam-channel = "0.2.4" +crossbeam-channel = "0.3.3" globset = { version = "0.4.2", path = "../globset" } lazy_static = "1.1.0" log = "0.4.5" @@ -32,7 +32,8 @@ walkdir = "2.2.5" version = "0.1.1" [dev-dependencies] -tempdir = "0.3.7" +# tempdir = "0.3.7" +tempfile = "3.0.5" [features] simd-accel = ["globset/simd-accel"] diff --git a/ignore/examples/walk.rs b/ignore/examples/walk.rs index 67432b71..1f2a3cea 100644 --- a/ignore/examples/walk.rs +++ b/ignore/examples/walk.rs @@ -37,19 +37,19 @@ fn main() { Box::new(move |result| { use ignore::WalkState::*; - tx.send(DirEntry::Y(result.unwrap())); + tx.send(DirEntry::Y(result.unwrap())).unwrap(); Continue }) }); } else if simple { let walker = WalkDir::new(path); for result in walker { - tx.send(DirEntry::X(result.unwrap())); + tx.send(DirEntry::X(result.unwrap())).unwrap(); } } else { let walker = WalkBuilder::new(path).build(); for result in walker { - tx.send(DirEntry::Y(result.unwrap())); + tx.send(DirEntry::Y(result.unwrap())).unwrap(); } } drop(tx); diff --git a/ignore/src/dir.rs b/ignore/src/dir.rs index 162b4c03..66b18635 100644 --- a/ignore/src/dir.rs +++ b/ignore/src/dir.rs @@ -661,7 +661,7 @@ mod tests { use std::io::Write; use std::path::Path; - use tempdir::TempDir; + use tempfile::{self, TempDir}; use dir::IgnoreBuilder; use gitignore::Gitignore; @@ -683,9 +683,13 @@ mod tests { } } + fn tmpdir(prefix: &str) -> TempDir { + tempfile::Builder::new().prefix(prefix).tempdir().unwrap() + } + #[test] fn explicit_ignore() { - let td = TempDir::new("ignore-test-").unwrap(); + let td = tmpdir("ignore-test-"); wfile(td.path().join("not-an-ignore"), "foo\n!bar"); let (gi, err) = Gitignore::new(td.path().join("not-an-ignore")); @@ -700,7 +704,7 @@ mod tests { #[test] fn git_exclude() { - let td = TempDir::new("ignore-test-").unwrap(); + let td = tmpdir("ignore-test-"); mkdirp(td.path().join(".git/info")); wfile(td.path().join(".git/info/exclude"), "foo\n!bar"); @@ -713,7 +717,7 @@ mod tests { #[test] fn gitignore() { - let td = TempDir::new("ignore-test-").unwrap(); + let td = tmpdir("ignore-test-"); mkdirp(td.path().join(".git")); wfile(td.path().join(".gitignore"), "foo\n!bar"); @@ -726,7 +730,7 @@ mod tests { #[test] fn gitignore_no_git() { - let td = TempDir::new("ignore-test-").unwrap(); + let td = tmpdir("ignore-test-"); wfile(td.path().join(".gitignore"), "foo\n!bar"); let (ig, err) = IgnoreBuilder::new().build().add_child(td.path()); @@ -738,7 +742,7 @@ mod tests { #[test] fn ignore() { - let td = TempDir::new("ignore-test-").unwrap(); + let td = tmpdir("ignore-test-"); wfile(td.path().join(".ignore"), "foo\n!bar"); let (ig, err) = IgnoreBuilder::new().build().add_child(td.path()); @@ -750,7 +754,7 @@ mod tests { #[test] fn custom_ignore() { - let td = TempDir::new("ignore-test-").unwrap(); + let td = tmpdir("ignore-test-"); let custom_ignore = ".customignore"; wfile(td.path().join(custom_ignore), "foo\n!bar"); @@ -766,7 +770,7 @@ mod tests { // Tests that a custom ignore file will override an .ignore. #[test] fn custom_ignore_over_ignore() { - let td = TempDir::new("ignore-test-").unwrap(); + let td = tmpdir("ignore-test-"); let custom_ignore = ".customignore"; wfile(td.path().join(".ignore"), "foo"); wfile(td.path().join(custom_ignore), "!foo"); @@ -781,7 +785,7 @@ mod tests { // Tests that earlier custom ignore files have lower precedence than later. #[test] fn custom_ignore_precedence() { - let td = TempDir::new("ignore-test-").unwrap(); + let td = tmpdir("ignore-test-"); let custom_ignore1 = ".customignore1"; let custom_ignore2 = ".customignore2"; wfile(td.path().join(custom_ignore1), "foo"); @@ -798,7 +802,7 @@ mod tests { // Tests that an .ignore will override a .gitignore. #[test] fn ignore_over_gitignore() { - let td = TempDir::new("ignore-test-").unwrap(); + let td = tmpdir("ignore-test-"); wfile(td.path().join(".gitignore"), "foo"); wfile(td.path().join(".ignore"), "!foo"); @@ -810,7 +814,7 @@ mod tests { // Tests that exclude has lower precedent than both .ignore and .gitignore. #[test] fn exclude_lowest() { - let td = TempDir::new("ignore-test-").unwrap(); + let td = tmpdir("ignore-test-"); wfile(td.path().join(".gitignore"), "!foo"); wfile(td.path().join(".ignore"), "!bar"); mkdirp(td.path().join(".git/info")); @@ -825,7 +829,7 @@ mod tests { #[test] fn errored() { - let td = TempDir::new("ignore-test-").unwrap(); + let td = tmpdir("ignore-test-"); wfile(td.path().join(".gitignore"), "f**oo"); let (_, err) = IgnoreBuilder::new().build().add_child(td.path()); @@ -834,7 +838,7 @@ mod tests { #[test] fn errored_both() { - let td = TempDir::new("ignore-test-").unwrap(); + let td = tmpdir("ignore-test-"); wfile(td.path().join(".gitignore"), "f**oo"); wfile(td.path().join(".ignore"), "fo**o"); @@ -844,7 +848,7 @@ mod tests { #[test] fn errored_partial() { - let td = TempDir::new("ignore-test-").unwrap(); + let td = tmpdir("ignore-test-"); mkdirp(td.path().join(".git")); wfile(td.path().join(".gitignore"), "f**oo\nbar"); @@ -855,7 +859,7 @@ mod tests { #[test] fn errored_partial_and_ignore() { - let td = TempDir::new("ignore-test-").unwrap(); + let td = tmpdir("ignore-test-"); wfile(td.path().join(".gitignore"), "f**oo\nbar"); wfile(td.path().join(".ignore"), "!bar"); @@ -866,7 +870,7 @@ mod tests { #[test] fn not_present_empty() { - let td = TempDir::new("ignore-test-").unwrap(); + let td = tmpdir("ignore-test-"); let (_, err) = IgnoreBuilder::new().build().add_child(td.path()); assert!(err.is_none()); @@ -876,7 +880,7 @@ mod tests { fn stops_at_git_dir() { // This tests that .gitignore files beyond a .git barrier aren't // matched, but .ignore files are. - let td = TempDir::new("ignore-test-").unwrap(); + let td = tmpdir("ignore-test-"); mkdirp(td.path().join(".git")); mkdirp(td.path().join("foo/.git")); wfile(td.path().join(".gitignore"), "foo"); @@ -897,7 +901,7 @@ mod tests { #[test] fn absolute_parent() { - let td = TempDir::new("ignore-test-").unwrap(); + let td = tmpdir("ignore-test-"); mkdirp(td.path().join(".git")); mkdirp(td.path().join("foo")); wfile(td.path().join(".gitignore"), "bar"); @@ -920,7 +924,7 @@ mod tests { #[test] fn absolute_parent_anchored() { - let td = TempDir::new("ignore-test-").unwrap(); + let td = tmpdir("ignore-test-"); mkdirp(td.path().join(".git")); mkdirp(td.path().join("src/llvm")); wfile(td.path().join(".gitignore"), "/llvm/\nfoo"); diff --git a/ignore/src/lib.rs b/ignore/src/lib.rs index ee313685..d0c8d2fc 100644 --- a/ignore/src/lib.rs +++ b/ignore/src/lib.rs @@ -56,7 +56,7 @@ extern crate memchr; extern crate regex; extern crate same_file; #[cfg(test)] -extern crate tempdir; +extern crate tempfile; extern crate thread_local; extern crate walkdir; #[cfg(windows)] diff --git a/ignore/src/walk.rs b/ignore/src/walk.rs index 3a4515cd..aee7a881 100644 --- a/ignore/src/walk.rs +++ b/ignore/src/walk.rs @@ -1118,7 +1118,7 @@ impl WalkParallel { dent: dent, ignore: self.ig_root.clone(), root_device: root_device, - })); + })).unwrap(); any_work = true; } // ... but there's no need to start workers if we don't need them. @@ -1431,7 +1431,7 @@ impl Worker { dent: dent, ignore: ig.clone(), root_device: root_device, - })); + })).unwrap(); } WalkState::Continue } @@ -1446,12 +1446,12 @@ impl Worker { return None; } match self.rx.try_recv() { - Some(Message::Work(work)) => { + Ok(Message::Work(work)) => { self.waiting(false); self.quitting(false); return Some(work); } - Some(Message::Quit) => { + Ok(Message::Quit) => { // We can't just quit because a Message::Quit could be // spurious. For example, it's possible to observe that // all workers are waiting even if there's more work to @@ -1482,12 +1482,12 @@ impl Worker { // Otherwise, spin. } } - None => { + Err(_) => { self.waiting(true); self.quitting(false); if self.num_waiting() == self.threads { for _ in 0..self.threads { - self.tx.send(Message::Quit); + self.tx.send(Message::Quit).unwrap(); } } else { // You're right to consider this suspicious, but it's @@ -1702,7 +1702,7 @@ mod tests { use std::path::Path; use std::sync::{Arc, Mutex}; - use tempdir::TempDir; + use tempfile::{self, TempDir}; use super::{DirEntry, WalkBuilder, WalkState}; @@ -1789,6 +1789,10 @@ mod tests { paths } + fn tmpdir(prefix: &str) -> TempDir { + tempfile::Builder::new().prefix(prefix).tempdir().unwrap() + } + fn assert_paths( prefix: &Path, builder: &WalkBuilder, @@ -1802,7 +1806,7 @@ mod tests { #[test] fn no_ignores() { - let td = TempDir::new("walk-test-").unwrap(); + let td = tmpdir("walk-test-"); mkdirp(td.path().join("a/b/c")); mkdirp(td.path().join("x/y")); wfile(td.path().join("a/b/foo"), ""); @@ -1815,7 +1819,7 @@ mod tests { #[test] fn custom_ignore() { - let td = TempDir::new("walk-test-").unwrap(); + let td = tmpdir("walk-test-"); let custom_ignore = ".customignore"; mkdirp(td.path().join("a")); wfile(td.path().join(custom_ignore), "foo"); @@ -1831,7 +1835,7 @@ mod tests { #[test] fn custom_ignore_exclusive_use() { - let td = TempDir::new("walk-test-").unwrap(); + let td = tmpdir("walk-test-"); let custom_ignore = ".customignore"; mkdirp(td.path().join("a")); wfile(td.path().join(custom_ignore), "foo"); @@ -1851,7 +1855,7 @@ mod tests { #[test] fn gitignore() { - let td = TempDir::new("walk-test-").unwrap(); + let td = tmpdir("walk-test-"); mkdirp(td.path().join(".git")); mkdirp(td.path().join("a")); wfile(td.path().join(".gitignore"), "foo"); @@ -1867,7 +1871,7 @@ mod tests { #[test] fn explicit_ignore() { - let td = TempDir::new("walk-test-").unwrap(); + let td = tmpdir("walk-test-"); let igpath = td.path().join(".not-an-ignore"); mkdirp(td.path().join("a")); wfile(&igpath, "foo"); @@ -1883,7 +1887,7 @@ mod tests { #[test] fn explicit_ignore_exclusive_use() { - let td = TempDir::new("walk-test-").unwrap(); + let td = tmpdir("walk-test-"); let igpath = td.path().join(".not-an-ignore"); mkdirp(td.path().join("a")); wfile(&igpath, "foo"); @@ -1901,7 +1905,7 @@ mod tests { #[test] fn gitignore_parent() { - let td = TempDir::new("walk-test-").unwrap(); + let td = tmpdir("walk-test-"); mkdirp(td.path().join(".git")); mkdirp(td.path().join("a")); wfile(td.path().join(".gitignore"), "foo"); @@ -1914,7 +1918,7 @@ mod tests { #[test] fn max_depth() { - let td = TempDir::new("walk-test-").unwrap(); + let td = tmpdir("walk-test-"); mkdirp(td.path().join("a/b/c")); wfile(td.path().join("foo"), ""); wfile(td.path().join("a/foo"), ""); @@ -1934,7 +1938,7 @@ mod tests { #[test] fn max_filesize() { - let td = TempDir::new("walk-test-").unwrap(); + let td = tmpdir("walk-test-"); mkdirp(td.path().join("a/b")); wfile_size(td.path().join("foo"), 0); wfile_size(td.path().join("bar"), 400); @@ -1961,7 +1965,7 @@ mod tests { #[cfg(unix)] // because symlinks on windows are weird #[test] fn symlinks() { - let td = TempDir::new("walk-test-").unwrap(); + let td = tmpdir("walk-test-"); mkdirp(td.path().join("a/b")); symlink(td.path().join("a/b"), td.path().join("z")); wfile(td.path().join("a/b/foo"), ""); @@ -1978,7 +1982,7 @@ mod tests { #[cfg(unix)] // because symlinks on windows are weird #[test] fn first_path_not_symlink() { - let td = TempDir::new("walk-test-").unwrap(); + let td = tmpdir("walk-test-"); mkdirp(td.path().join("foo")); let dents = WalkBuilder::new(td.path().join("foo")) @@ -1999,7 +2003,7 @@ mod tests { #[cfg(unix)] // because symlinks on windows are weird #[test] fn symlink_loop() { - let td = TempDir::new("walk-test-").unwrap(); + let td = tmpdir("walk-test-"); mkdirp(td.path().join("a/b")); symlink(td.path().join("a"), td.path().join("a/b/c")); @@ -2029,7 +2033,7 @@ mod tests { // If our test directory actually isn't a different volume from /sys, // then this test is meaningless and we shouldn't run it. - let td = TempDir::new("walk-test-").unwrap(); + let td = tmpdir("walk-test-"); if device_num(td.path()).unwrap() == device_num("/sys").unwrap() { return; }