replace deprecated and unmaintained tempfile 0.3 with tempdir 3.1

This commit is contained in:
Alexandru Macovei 2020-10-07 09:54:37 +03:00
parent 9db5110b5d
commit cb290288b7
3 changed files with 41 additions and 33 deletions

66
Cargo.lock generated
View file

@ -201,12 +201,6 @@ dependencies = [
"synstructure",
]
[[package]]
name = "fuchsia-cprng"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a06f77d526c1a601b7c4cdd98f54b5eaabffc14d5f2f0296febdc7f357c6d3ba"
[[package]]
name = "getrandom"
version = "0.1.6"
@ -228,7 +222,7 @@ dependencies = [
"slog",
"slog-async",
"slog-term",
"tempdir",
"tempfile",
]
[[package]]
@ -361,6 +355,12 @@ version = "0.3.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "676e8eb2b1b4c9043511a9b7bea0915320d7e502b0a079fb03f9635a5252b18c"
[[package]]
name = "ppv-lite86"
version = "0.2.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c36fa947111f5c62a733b652544dd0016a43ce89619538a8ef92724a6f501a20"
[[package]]
name = "proc-macro2"
version = "0.4.30"
@ -381,39 +381,43 @@ dependencies = [
[[package]]
name = "rand"
version = "0.4.6"
version = "0.7.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "552840b97013b1a26992c11eac34bdd778e464601a4c2054b5f0bff7c6761293"
checksum = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03"
dependencies = [
"fuchsia-cprng",
"getrandom",
"libc",
"rand_core 0.3.1",
"rdrand",
"winapi",
"rand_chacha",
"rand_core",
"rand_hc",
]
[[package]]
name = "rand_chacha"
version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f4c8ed856279c9737206bf725bf36935d8666ead7aa69b52be55af369d193402"
dependencies = [
"ppv-lite86",
"rand_core",
]
[[package]]
name = "rand_core"
version = "0.3.1"
version = "0.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7a6fdeb83b075e8266dcc8762c22776f6877a63111121f5f8c7411e5be7eed4b"
checksum = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19"
dependencies = [
"rand_core 0.4.0",
"getrandom",
]
[[package]]
name = "rand_core"
version = "0.4.0"
name = "rand_hc"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d0e7a549d590831370895ab7ba4ea0c1b6b011d106b5ff2da6eee112615e6dc0"
[[package]]
name = "rdrand"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "678054eb77286b51581ba43620cc911abf02758c91f93f479767aed0f90458b2"
checksum = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c"
dependencies = [
"rand_core 0.3.1",
"rand_core",
]
[[package]]
@ -539,13 +543,17 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f764005d11ee5f36500a149ace24e00e3da98b0158b3e2d53a7495660d3f4d60"
[[package]]
name = "tempdir"
version = "0.3.7"
name = "tempfile"
version = "3.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "15f2b5fb00ccdf689e0149d1b1b3c03fead81c2b37735d812fa8bddbbf41b6d8"
checksum = "7a6e24d9338a0a5be79593e2fa15a648add6138caa803e2d5bc782c371732ca9"
dependencies = [
"cfg-if",
"libc",
"rand",
"redox_syscall",
"remove_dir_all",
"winapi",
]
[[package]]

View file

@ -33,4 +33,4 @@ failure = "~0.1"
memchr = "~2.3"
[dev-dependencies]
tempdir = "~0.3"
tempfile = "~3.1"

View file

@ -118,7 +118,7 @@ where
#[cfg(test)]
mod tests {
use tempdir;
use tempfile;
use super::*;
@ -126,9 +126,9 @@ mod tests {
slog::Logger::root(slog::Discard, o!())
}
fn init_repo() -> (tempdir::TempDir, git2::Repository) {
fn init_repo() -> (tempfile::TempDir, git2::Repository) {
// the repo will be deleted when the tempdir gets dropped
let dir = tempdir::TempDir::new("git-absorb").unwrap();
let dir = tempfile::TempDir::new().unwrap();
// TODO: use in-memory ODB instead (blocked on git2 support)
let repo = git2::Repository::init(&dir).unwrap();