@@ -88,7 +88,7 @@ macro_rules! test_mod {
88
88
( $( $use_stmt: item) * ) => {
89
89
#[ cfg( test) ]
90
90
mod test {
91
- extern crate tempdir ;
91
+ extern crate tempfile ;
92
92
extern crate test;
93
93
94
94
use super :: * ;
@@ -104,7 +104,7 @@ macro_rules! test_mod {
104
104
/// Tests shared file lock operations.
105
105
#[ test]
106
106
fn lock_shared( ) {
107
- let tempdir = tempdir :: TempDir :: new ( "fs4" ) . unwrap( ) ;
107
+ let tempdir = tempfile :: TempDir :: with_prefix ( "fs4" ) . unwrap( ) ;
108
108
let path = tempdir. path( ) . join( "fs4" ) ;
109
109
let file1 = fs:: OpenOptions :: new( )
110
110
. read( true )
@@ -149,7 +149,7 @@ macro_rules! test_mod {
149
149
/// Tests exclusive file lock operations.
150
150
#[ test]
151
151
fn lock_exclusive( ) {
152
- let tempdir = tempdir :: TempDir :: new ( "fs4" ) . unwrap( ) ;
152
+ let tempdir = tempfile :: TempDir :: with_prefix ( "fs4" ) . unwrap( ) ;
153
153
let path = tempdir. path( ) . join( "fs4" ) ;
154
154
let file1 = fs:: OpenOptions :: new( )
155
155
. read( true )
@@ -185,7 +185,7 @@ macro_rules! test_mod {
185
185
/// Tests that a lock is released after the file that owns it is dropped.
186
186
#[ test]
187
187
fn lock_cleanup( ) {
188
- let tempdir = tempdir :: TempDir :: new ( "fs4" ) . unwrap( ) ;
188
+ let tempdir = tempfile :: TempDir :: with_prefix ( "fs4" ) . unwrap( ) ;
189
189
let path = tempdir. path( ) . join( "fs4" ) ;
190
190
let file1 = fs:: OpenOptions :: new( )
191
191
. read( true )
@@ -216,7 +216,7 @@ macro_rules! test_mod {
216
216
/// Tests file allocation.
217
217
#[ test]
218
218
fn allocate( ) {
219
- let tempdir = tempdir :: TempDir :: new ( "fs4" ) . unwrap( ) ;
219
+ let tempdir = tempfile :: TempDir :: with_prefix ( "fs4" ) . unwrap( ) ;
220
220
let path = tempdir. path( ) . join( "fs4" ) ;
221
221
let file = fs:: OpenOptions :: new( )
222
222
. write( true )
@@ -248,7 +248,7 @@ macro_rules! test_mod {
248
248
/// Checks filesystem space methods.
249
249
#[ test]
250
250
fn filesystem_space( ) {
251
- let tempdir = tempdir :: TempDir :: new ( "fs4" ) . unwrap( ) ;
251
+ let tempdir = tempfile :: TempDir :: with_prefix ( "fs4" ) . unwrap( ) ;
252
252
let FsStats {
253
253
free_space,
254
254
available_space,
@@ -265,7 +265,7 @@ macro_rules! test_mod {
265
265
/// for comparing against the truncate and allocate benchmarks.
266
266
#[ bench]
267
267
fn bench_file_create( b: & mut test:: Bencher ) {
268
- let tempdir = tempdir :: TempDir :: new ( "fs4" ) . unwrap( ) ;
268
+ let tempdir = tempfile :: TempDir :: with_prefix ( "fs4" ) . unwrap( ) ;
269
269
let path = tempdir. path( ) . join( "file" ) ;
270
270
271
271
b. iter( || {
@@ -284,7 +284,7 @@ macro_rules! test_mod {
284
284
#[ bench]
285
285
fn bench_file_truncate( b: & mut test:: Bencher ) {
286
286
let size = 32 * 1024 * 1024 ;
287
- let tempdir = tempdir :: TempDir :: new ( "fs4" ) . unwrap( ) ;
287
+ let tempdir = tempfile :: TempDir :: with_prefix ( "fs4" ) . unwrap( ) ;
288
288
let path = tempdir. path( ) . join( "file" ) ;
289
289
290
290
b. iter( || {
@@ -304,7 +304,7 @@ macro_rules! test_mod {
304
304
#[ bench]
305
305
fn bench_file_allocate( b: & mut test:: Bencher ) {
306
306
let size = 32 * 1024 * 1024 ;
307
- let tempdir = tempdir :: TempDir :: new ( "fs4" ) . unwrap( ) ;
307
+ let tempdir = tempfile :: TempDir :: with_prefix ( "fs4" ) . unwrap( ) ;
308
308
let path = tempdir. path( ) . join( "file" ) ;
309
309
310
310
b. iter( || {
@@ -324,7 +324,7 @@ macro_rules! test_mod {
324
324
#[ bench]
325
325
fn bench_allocated_size( b: & mut test:: Bencher ) {
326
326
let size = 32 * 1024 * 1024 ;
327
- let tempdir = tempdir :: TempDir :: new ( "fs4" ) . unwrap( ) ;
327
+ let tempdir = tempfile :: TempDir :: with_prefix ( "fs4" ) . unwrap( ) ;
328
328
let path = tempdir. path( ) . join( "file" ) ;
329
329
let file = fs:: OpenOptions :: new( )
330
330
. read( true )
@@ -343,7 +343,7 @@ macro_rules! test_mod {
343
343
/// Benchmarks locking and unlocking a file lock.
344
344
#[ bench]
345
345
fn bench_lock_unlock( b: & mut test:: Bencher ) {
346
- let tempdir = tempdir :: TempDir :: new ( "fs4" ) . unwrap( ) ;
346
+ let tempdir = tempfile :: TempDir :: with_prefix ( "fs4" ) . unwrap( ) ;
347
347
let path = tempdir. path( ) . join( "fs4" ) ;
348
348
let file = fs:: OpenOptions :: new( )
349
349
. read( true )
@@ -362,7 +362,7 @@ macro_rules! test_mod {
362
362
/// Benchmarks the free space method.
363
363
#[ bench]
364
364
fn bench_free_space( b: & mut test:: Bencher ) {
365
- let tempdir = tempdir :: TempDir :: new ( "fs4" ) . unwrap( ) ;
365
+ let tempdir = tempfile :: TempDir :: with_prefix ( "fs4" ) . unwrap( ) ;
366
366
b. iter( || {
367
367
test:: black_box( free_space( tempdir. path( ) ) . unwrap( ) ) ;
368
368
} ) ;
@@ -371,7 +371,7 @@ macro_rules! test_mod {
371
371
/// Benchmarks the available space method.
372
372
#[ bench]
373
373
fn bench_available_space( b: & mut test:: Bencher ) {
374
- let tempdir = tempdir :: TempDir :: new ( "fs4" ) . unwrap( ) ;
374
+ let tempdir = tempfile :: TempDir :: with_prefix ( "fs4" ) . unwrap( ) ;
375
375
b. iter( || {
376
376
test:: black_box( available_space( tempdir. path( ) ) . unwrap( ) ) ;
377
377
} ) ;
@@ -380,7 +380,7 @@ macro_rules! test_mod {
380
380
/// Benchmarks the total space method.
381
381
#[ bench]
382
382
fn bench_total_space( b: & mut test:: Bencher ) {
383
- let tempdir = tempdir :: TempDir :: new ( "fs4" ) . unwrap( ) ;
383
+ let tempdir = tempfile :: TempDir :: with_prefix ( "fs4" ) . unwrap( ) ;
384
384
b. iter( || {
385
385
test:: black_box( total_space( tempdir. path( ) ) . unwrap( ) ) ;
386
386
} ) ;
0 commit comments