@@ -30,22 +30,23 @@ pub(crate) fn random_storage_path() -> PathBuf {
3030}
3131
3232pub ( crate ) fn do_read_write_remove_list_persist < K : KVStoreSync + RefUnwindSafe > ( kv_store : & K ) {
33- let data = [ 42u8 ; 32 ] ;
33+ let data = vec ! [ 42u8 ; 32 ] ;
3434
3535 let primary_namespace = "testspace" ;
3636 let secondary_namespace = "testsubspace" ;
3737 let key = "testkey" ;
3838
3939 // Test the basic KVStore operations.
40- kv_store. write ( primary_namespace, secondary_namespace, key, & data) . unwrap ( ) ;
40+ kv_store. write ( primary_namespace, secondary_namespace, key, data. clone ( ) ) . unwrap ( ) ;
4141
4242 // Test empty primary/secondary namespaces are allowed, but not empty primary namespace and non-empty
4343 // secondary primary_namespace, and not empty key.
44- kv_store. write ( "" , "" , key, & data) . unwrap ( ) ;
45- let res = std:: panic:: catch_unwind ( || kv_store. write ( "" , secondary_namespace, key, & data) ) ;
44+ kv_store. write ( "" , "" , key, data. clone ( ) ) . unwrap ( ) ;
45+ let res =
46+ std:: panic:: catch_unwind ( || kv_store. write ( "" , secondary_namespace, key, data. clone ( ) ) ) ;
4647 assert ! ( res. is_err( ) ) ;
4748 let res = std:: panic:: catch_unwind ( || {
48- kv_store. write ( primary_namespace, secondary_namespace, "" , & data)
49+ kv_store. write ( primary_namespace, secondary_namespace, "" , data. clone ( ) )
4950 } ) ;
5051 assert ! ( res. is_err( ) ) ;
5152
@@ -63,7 +64,7 @@ pub(crate) fn do_read_write_remove_list_persist<K: KVStoreSync + RefUnwindSafe>(
6364
6465 // Ensure we have no issue operating with primary_namespace/secondary_namespace/key being KVSTORE_NAMESPACE_KEY_MAX_LEN
6566 let max_chars: String = std:: iter:: repeat ( 'A' ) . take ( KVSTORE_NAMESPACE_KEY_MAX_LEN ) . collect ( ) ;
66- kv_store. write ( & max_chars, & max_chars, & max_chars, & data) . unwrap ( ) ;
67+ kv_store. write ( & max_chars, & max_chars, & max_chars, data. clone ( ) ) . unwrap ( ) ;
6768
6869 let listed_keys = kv_store. list ( & max_chars, & max_chars) . unwrap ( ) ;
6970 assert_eq ! ( listed_keys. len( ) , 1 ) ;
0 commit comments