@@ -218,7 +218,6 @@ pub fn count_json_files(dir: &Path) -> usize {
218218#[ cfg( test) ]
219219mod tests {
220220 use super :: * ;
221- use tempfile:: TempDir ;
222221
223222 #[ derive( serde:: Serialize , serde:: Deserialize , PartialEq , Debug ) ]
224223 struct V {
@@ -227,7 +226,7 @@ mod tests {
227226
228227 #[ test]
229228 fn test_read_write_roundtrip ( ) {
230- let tmp = TempDir :: new ( ) . unwrap ( ) ;
229+ let tmp = crate :: testing :: tempdir ( ) . unwrap ( ) ;
231230 let path = tmp. path ( ) . join ( "sub/entry.json" ) ;
232231
233232 // Missing file is a miss.
@@ -240,22 +239,22 @@ mod tests {
240239
241240 #[ test]
242241 fn test_read_corrupt_json_returns_none ( ) {
243- let tmp = TempDir :: new ( ) . unwrap ( ) ;
242+ let tmp = crate :: testing :: tempdir ( ) . unwrap ( ) ;
244243 let path = tmp. path ( ) . join ( "bad.json" ) ;
245244 fs:: write ( & path, "not json {{" ) . unwrap ( ) ;
246245 assert ! ( read_json:: <V >( & path) . is_none( ) ) ;
247246 }
248247
249248 #[ test]
250249 fn test_clear_one_missing_returns_false ( ) {
251- let tmp = TempDir :: new ( ) . unwrap ( ) ;
250+ let tmp = crate :: testing :: tempdir ( ) . unwrap ( ) ;
252251 let path = tmp. path ( ) . join ( "nope.json" ) ;
253252 assert ! ( !clear_one( & path) . unwrap( ) ) ;
254253 }
255254
256255 #[ test]
257256 fn test_clear_one_propagates_non_not_found ( ) {
258- let tmp = TempDir :: new ( ) . unwrap ( ) ;
257+ let tmp = crate :: testing :: tempdir ( ) . unwrap ( ) ;
259258 // Put a directory where a file is expected so remove_file returns
260259 // EISDIR (or similar), not NotFound.
261260 let path = tmp. path ( ) . join ( "dir.json" ) ;
@@ -266,7 +265,7 @@ mod tests {
266265
267266 #[ test]
268267 fn test_clear_json_files_counts_and_skips ( ) {
269- let tmp = TempDir :: new ( ) . unwrap ( ) ;
268+ let tmp = crate :: testing :: tempdir ( ) . unwrap ( ) ;
270269 let dir = tmp. path ( ) . join ( "c" ) ;
271270 fs:: create_dir_all ( & dir) . unwrap ( ) ;
272271 fs:: write ( dir. join ( "a.json" ) , "{}" ) . unwrap ( ) ;
@@ -284,13 +283,13 @@ mod tests {
284283
285284 #[ test]
286285 fn test_clear_json_files_missing_dir_is_zero ( ) {
287- let tmp = TempDir :: new ( ) . unwrap ( ) ;
286+ let tmp = crate :: testing :: tempdir ( ) . unwrap ( ) ;
288287 assert_eq ! ( clear_json_files( & tmp. path( ) . join( "nope" ) ) . unwrap( ) , 0 ) ;
289288 }
290289
291290 #[ test]
292291 fn test_clear_json_files_propagates_read_dir_error ( ) {
293- let tmp = TempDir :: new ( ) . unwrap ( ) ;
292+ let tmp = crate :: testing :: tempdir ( ) . unwrap ( ) ;
294293 // Put a file where a directory is expected — read_dir returns
295294 // NotADirectory (not NotFound).
296295 let path = tmp. path ( ) . join ( "not-a-dir" ) ;
@@ -301,7 +300,7 @@ mod tests {
301300
302301 #[ test]
303302 fn test_count_json_files ( ) {
304- let tmp = TempDir :: new ( ) . unwrap ( ) ;
303+ let tmp = crate :: testing :: tempdir ( ) . unwrap ( ) ;
305304 let dir = tmp. path ( ) . join ( "c" ) ;
306305 fs:: create_dir_all ( & dir) . unwrap ( ) ;
307306 fs:: write ( dir. join ( "a.json" ) , "{}" ) . unwrap ( ) ;
@@ -313,7 +312,7 @@ mod tests {
313312
314313 #[ test]
315314 fn test_sweep_lru_trims_oldest_entries ( ) {
316- let tmp = TempDir :: new ( ) . unwrap ( ) ;
315+ let tmp = crate :: testing :: tempdir ( ) . unwrap ( ) ;
317316 let dir = tmp. path ( ) . join ( "c" ) ;
318317 fs:: create_dir_all ( & dir) . unwrap ( ) ;
319318
@@ -335,7 +334,7 @@ mod tests {
335334
336335 #[ test]
337336 fn test_sweep_lru_no_op_under_bound ( ) {
338- let tmp = TempDir :: new ( ) . unwrap ( ) ;
337+ let tmp = crate :: testing :: tempdir ( ) . unwrap ( ) ;
339338 let dir = tmp. path ( ) . join ( "c" ) ;
340339 fs:: create_dir_all ( & dir) . unwrap ( ) ;
341340
0 commit comments