@@ -270,23 +270,23 @@ mod tests {
270
270
271
271
#[ test]
272
272
fn test_put_update ( ) {
273
- let mut cache: LruCache < ~ str , Vec < u8 > > = LruCache :: new ( 1 ) ;
274
- cache. put ( "1" . to_owned ( ) , vec ! [ 10 , 10 ] ) ;
275
- cache. put ( "1" . to_owned ( ) , vec ! [ 10 , 19 ] ) ;
276
- assert_opt_eq ( cache. get ( & "1" . to_owned ( ) ) , vec ! [ 10 , 19 ] ) ;
273
+ let mut cache: LruCache < StrBuf , Vec < u8 > > = LruCache :: new ( 1 ) ;
274
+ cache. put ( "1" . to_strbuf ( ) , vec ! [ 10 , 10 ] ) ;
275
+ cache. put ( "1" . to_strbuf ( ) , vec ! [ 10 , 19 ] ) ;
276
+ assert_opt_eq ( cache. get ( & "1" . to_strbuf ( ) ) , vec ! [ 10 , 19 ] ) ;
277
277
assert_eq ! ( cache. len( ) , 1 ) ;
278
278
}
279
279
280
280
#[ test]
281
281
fn test_expire_lru ( ) {
282
- let mut cache: LruCache < ~ str , ~ str > = LruCache :: new ( 2 ) ;
283
- cache. put ( "foo1" . to_owned ( ) , "bar1" . to_owned ( ) ) ;
284
- cache. put ( "foo2" . to_owned ( ) , "bar2" . to_owned ( ) ) ;
285
- cache. put ( "foo3" . to_owned ( ) , "bar3" . to_owned ( ) ) ;
286
- assert ! ( cache. get( & "foo1" . to_owned ( ) ) . is_none( ) ) ;
287
- cache. put ( "foo2" . to_owned ( ) , "bar2update" . to_owned ( ) ) ;
288
- cache. put ( "foo4" . to_owned ( ) , "bar4" . to_owned ( ) ) ;
289
- assert ! ( cache. get( & "foo3" . to_owned ( ) ) . is_none( ) ) ;
282
+ let mut cache: LruCache < StrBuf , StrBuf > = LruCache :: new ( 2 ) ;
283
+ cache. put ( "foo1" . to_strbuf ( ) , "bar1" . to_strbuf ( ) ) ;
284
+ cache. put ( "foo2" . to_strbuf ( ) , "bar2" . to_strbuf ( ) ) ;
285
+ cache. put ( "foo3" . to_strbuf ( ) , "bar3" . to_strbuf ( ) ) ;
286
+ assert ! ( cache. get( & "foo1" . to_strbuf ( ) ) . is_none( ) ) ;
287
+ cache. put ( "foo2" . to_strbuf ( ) , "bar2update" . to_strbuf ( ) ) ;
288
+ cache. put ( "foo4" . to_strbuf ( ) , "bar4" . to_strbuf ( ) ) ;
289
+ assert ! ( cache. get( & "foo3" . to_strbuf ( ) ) . is_none( ) ) ;
290
290
}
291
291
292
292
#[ test]
0 commit comments