mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-03 00:31:50 +00:00
replace tempdir by tempfile (#2143)
## Issue Addressed Fixes #2141 Remove [tempdir](https://docs.rs/tempdir/0.3.7/tempdir/) in favor of [tempfile](https://docs.rs/tempfile/3.1.0/tempfile/). ## Proposed Changes `tempfile` has a slightly different api that makes creating temp folders with a name prefix a chore (`tempdir::TempDir::new("toto")` => `tempfile::Builder::new().prefix("toto").tempdir()`). So I removed temp folder name prefix where I deemed it not useful. Otherwise, the functionality is the same.
This commit is contained in:
@@ -8,4 +8,4 @@ edition = "2018"
|
||||
fs2 = "0.4.3"
|
||||
|
||||
[dev-dependencies]
|
||||
tempdir = "0.3.7"
|
||||
tempfile = "3.1.0"
|
||||
|
||||
@@ -72,14 +72,14 @@ impl Drop for Lockfile {
|
||||
#[cfg(test)]
|
||||
mod test {
|
||||
use super::*;
|
||||
use tempdir::TempDir;
|
||||
use tempfile::tempdir;
|
||||
|
||||
#[cfg(unix)]
|
||||
use std::{fs::Permissions, os::unix::fs::PermissionsExt};
|
||||
|
||||
#[test]
|
||||
fn new_lock() {
|
||||
let temp = TempDir::new("lock_test").unwrap();
|
||||
let temp = tempdir().unwrap();
|
||||
let path = temp.path().join("lockfile");
|
||||
|
||||
let _lock = Lockfile::new(path.clone()).unwrap();
|
||||
@@ -91,7 +91,7 @@ mod test {
|
||||
|
||||
#[test]
|
||||
fn relock_after_drop() {
|
||||
let temp = TempDir::new("lock_test").unwrap();
|
||||
let temp = tempdir().unwrap();
|
||||
let path = temp.path().join("lockfile");
|
||||
|
||||
let lock1 = Lockfile::new(path.clone()).unwrap();
|
||||
@@ -105,7 +105,7 @@ mod test {
|
||||
|
||||
#[test]
|
||||
fn lockfile_exists() {
|
||||
let temp = TempDir::new("lock_test").unwrap();
|
||||
let temp = tempdir().unwrap();
|
||||
let path = temp.path().join("lockfile");
|
||||
|
||||
let _lockfile = File::create(&path).unwrap();
|
||||
@@ -117,7 +117,7 @@ mod test {
|
||||
#[test]
|
||||
#[cfg(unix)]
|
||||
fn permission_denied_create() {
|
||||
let temp = TempDir::new("lock_test").unwrap();
|
||||
let temp = tempdir().unwrap();
|
||||
let path = temp.path().join("lockfile");
|
||||
|
||||
let lockfile = File::create(&path).unwrap();
|
||||
|
||||
Reference in New Issue
Block a user