@@ -318,7 +318,8 @@ mod tests {
318
318
flushed. push ( ( * k, v) ) ;
319
319
Ok :: < ( ) , ( ) > ( ( ) )
320
320
} )
321
- . unwrap ( ) ;
321
+ . expect ( "cache corrupted" )
322
+ . expect ( "flush failed" ) ;
322
323
323
324
assert_eq ! ( flushed, vec![ ( 1 , 1 ) ] ) ;
324
325
@@ -331,7 +332,8 @@ mod tests {
331
332
flushed. push ( ( * k, v) ) ;
332
333
Ok :: < ( ) , ( ) > ( ( ) )
333
334
} )
334
- . unwrap ( ) ;
335
+ . expect ( "cache corrupted" )
336
+ . expect ( "flush failed" ) ;
335
337
336
338
assert_eq ! ( flushed, vec![ ( 2 , 2 ) , ( 1 , 3 ) ] ) ;
337
339
}
@@ -351,7 +353,8 @@ mod tests {
351
353
flushed. push ( ( * k, v) ) ;
352
354
Ok :: < ( ) , ( ) > ( ( ) )
353
355
} )
354
- . unwrap ( ) ;
356
+ . expect ( "cache corrupted" )
357
+ . expect ( "flush failed" ) ;
355
358
356
359
assert_eq ! ( flushed, [ ( 3 , 3 ) , ( 2 , 2 ) ] ) ;
357
360
}
@@ -390,10 +393,10 @@ mod property_tests {
390
393
let mut cache = LruCache :: new( 10 ) ;
391
394
for op in ops {
392
395
match op {
393
- CacheOp :: Insert ( v) => { cache. insert( v, v) ; }
394
- CacheOp :: Get ( v) => { cache. get( & v) ; }
395
- CacheOp :: InsertClean ( v) => { cache. insert_clean( v, v) ; }
396
- CacheOp :: Flush => { cache. flush( |_, _| Ok :: <( ) , ( ) >( ( ) ) ) . unwrap ( ) ; }
396
+ CacheOp :: Insert ( v) => { cache. insert( v, v) . expect ( "cache corrupted" ) ; }
397
+ CacheOp :: Get ( v) => { cache. get( & v) . expect ( "cache corrupted" ) ; }
398
+ CacheOp :: InsertClean ( v) => { cache. insert_clean( v, v) . expect ( "cache corrupted" ) ; }
399
+ CacheOp :: Flush => { cache. flush( |_, _| Ok :: <( ) , ( ) >( ( ) ) ) . expect ( "cache corrupted" ) . expect ( "flush failed" ) ; }
397
400
}
398
401
}
399
402
}
@@ -403,7 +406,7 @@ mod property_tests {
403
406
let capacity = 10 ;
404
407
let mut cache = LruCache :: new( capacity) ;
405
408
for op in ops {
406
- cache. insert( op, op) ;
409
+ cache. insert( op, op) . expect ( "cache corrupted" ) ;
407
410
prop_assert!( cache. cache. len( ) <= capacity) ;
408
411
prop_assert!( cache. order. len( ) <= capacity) ;
409
412
}
@@ -414,10 +417,10 @@ mod property_tests {
414
417
let mut cache = LruCache :: new( 10 ) ;
415
418
for op in ops {
416
419
match op {
417
- CacheOp :: Insert ( v) => { cache. insert( v, v) ; }
418
- CacheOp :: Get ( v) => { cache. get( & v) ; }
419
- CacheOp :: InsertClean ( v) => { cache. insert_clean( v, v) ; }
420
- CacheOp :: Flush => { cache. flush( |_, _| Ok :: <( ) , ( ) >( ( ) ) ) . unwrap ( ) ; }
420
+ CacheOp :: Insert ( v) => { cache. insert( v, v) . expect ( "cache corrupted" ) ; }
421
+ CacheOp :: Get ( v) => { cache. get( & v) . expect ( "cache corrupted" ) ; }
422
+ CacheOp :: InsertClean ( v) => { cache. insert_clean( v, v) . expect ( "cache corrupted" ) ; }
423
+ CacheOp :: Flush => { cache. flush( |_, _| Ok :: <( ) , ( ) >( ( ) ) ) . expect ( "cache corrupted" ) . expect ( "flush failed" ) ; }
421
424
}
422
425
// Verify linked list integrity
423
426
if !cache. order. is_empty( ) {
0 commit comments