@@ -101,7 +101,7 @@ fn dictionary_clone() {
101
101
102
102
#[ allow( clippy:: redundant_clone) ]
103
103
let clone = dictionary. clone ( ) ;
104
- Dictionary :: from_variant ( & clone. get ( "bar" ) . unwrap ( ) ) . insert ( "final" , 4 ) ;
104
+ Dictionary :: from_variant ( & clone. get ( "bar" ) . unwrap ( ) ) . set ( "final" , 4 ) ;
105
105
assert_eq ! ( subdictionary. get( "final" ) , Some ( 4 . to_variant( ) ) ) ;
106
106
}
107
107
@@ -147,7 +147,7 @@ fn dictionary_duplicate_deep() {
147
147
"bar" : subdictionary. clone( )
148
148
} ;
149
149
let clone = dictionary. duplicate_deep ( ) ;
150
- Dictionary :: from_variant ( & clone. get ( "bar" ) . unwrap ( ) ) . insert ( "baz" , 4 ) ;
150
+ Dictionary :: from_variant ( & clone. get ( "bar" ) . unwrap ( ) ) . set ( "baz" , 4 ) ;
151
151
assert_eq ! (
152
152
subdictionary. get( "baz" ) ,
153
153
Some ( true . to_variant( ) ) ,
@@ -167,14 +167,14 @@ fn dictionary_duplicate_shallow() {
167
167
} ;
168
168
169
169
let mut clone = dictionary. duplicate_shallow ( ) ;
170
- Dictionary :: from_variant ( & clone. get ( "bar" ) . unwrap ( ) ) . insert ( "baz" , 4 ) ;
170
+ Dictionary :: from_variant ( & clone. get ( "bar" ) . unwrap ( ) ) . set ( "baz" , 4 ) ;
171
171
assert_eq ! (
172
172
subdictionary. get( "baz" ) ,
173
173
Some ( 4 . to_variant( ) ) ,
174
174
"key = \" baz\" "
175
175
) ;
176
176
177
- clone. insert ( "foo" , false . to_variant ( ) ) ;
177
+ clone. set ( "foo" , false ) ;
178
178
assert_eq ! ( dictionary. get( "foo" ) , Some ( 0 . to_variant( ) ) ) ;
179
179
assert_eq ! ( clone. get( "foo" ) , Some ( false . to_variant( ) ) ) ;
180
180
}
@@ -256,13 +256,13 @@ fn dictionary_insert_multiple() {
256
256
let mut dictionary = dict ! { } ;
257
257
assert ! ( dictionary. is_empty( ) ) ;
258
258
259
- dictionary. insert ( 1 , true ) ;
259
+ dictionary. set ( 1 , true ) ;
260
260
assert_eq ! ( dictionary. get( 1 ) , Some ( true . to_variant( ) ) ) ;
261
261
262
262
let mut other = dict ! { } ;
263
263
assert ! ( other. is_empty( ) ) ;
264
264
265
- other. insert ( 1 , 2 ) ;
265
+ other. set ( 1 , 2 ) ;
266
266
assert_eq ! ( other. get( 1 ) , Some ( 2 . to_variant( ) ) ) ;
267
267
}
268
268
#[ itest]
@@ -430,7 +430,7 @@ fn dictionary_iter_size_hint() {
430
430
assert_eq ! ( iter. size_hint( ) , ( 0 , Some ( 0 ) ) ) ;
431
431
432
432
// Insertion while iterating is allowed and might change size hint.
433
- dictionary_clone. insert ( "new_key" , "soma_val" ) ;
433
+ dictionary_clone. set ( "new_key" , "soma_val" ) ;
434
434
assert_eq ! ( iter. size_hint( ) , ( 1 , Some ( 1 ) ) ) ;
435
435
436
436
// Removal while iterating is also allowed and might change size_hint.
@@ -465,7 +465,9 @@ fn dictionary_iter_insert() {
465
465
iter. next ( ) ;
466
466
iter. next ( ) ;
467
467
468
- dictionary2. insert ( "new_key" , 10 ) ;
468
+ let prev = dictionary2. insert ( "new_key" , 10 ) ;
469
+ assert_eq ! ( prev, None ) ;
470
+
469
471
let v: Vec < _ > = iter. collect ( ) ;
470
472
assert_eq ! ( dictionary. len( ) , 5 ) ;
471
473
assert ! ( dictionary. contains_key( "new_key" ) ) ;
@@ -488,7 +490,7 @@ fn dictionary_iter_insert_after_completion() {
488
490
}
489
491
assert_eq ! ( iter. next( ) , None ) ;
490
492
491
- dictionary2. insert ( "new_key" , 10 ) ;
493
+ dictionary2. set ( "new_key" , 10 ) ;
492
494
assert_eq ! ( iter. next( ) , None ) ;
493
495
assert_eq ! ( dictionary. len( ) , 5 ) ;
494
496
}
@@ -504,7 +506,7 @@ fn dictionary_iter_big() {
504
506
for _ in 0 ..16 {
505
507
iter. next ( ) ;
506
508
}
507
- dictionary2. insert ( "a" , "b" ) ;
509
+ dictionary2. set ( "a" , "b" ) ;
508
510
}
509
511
dictionary2. clear ( ) ;
510
512
dictionary2. extend ( ( 0 ..64 ) . zip ( 0 ..64 ) ) ;
@@ -531,7 +533,7 @@ fn dictionary_iter_simultaneous() {
531
533
} )
532
534
. collect ( ) ;
533
535
534
- assert ! ( map. len( ) == 4 ) ;
536
+ assert_eq ! ( map. len( ) , 4 ) ;
535
537
536
538
let mut tens = 0 ;
537
539
let mut trues = 0 ;
0 commit comments