@@ -43,8 +43,8 @@ struct ClientIdAttribute {
43
43
client_id : ClientId ,
44
44
}
45
45
46
- impl From < & ClientIdAttribute > for abci:: EventAttribute {
47
- fn from ( attr : & ClientIdAttribute ) -> Self {
46
+ impl From < ClientIdAttribute > for abci:: EventAttribute {
47
+ fn from ( attr : ClientIdAttribute ) -> Self {
48
48
( CLIENT_ID_ATTRIBUTE_KEY , attr. client_id . as_str ( ) ) . into ( )
49
49
}
50
50
}
@@ -67,8 +67,8 @@ struct ClientTypeAttribute {
67
67
client_type : ClientType ,
68
68
}
69
69
70
- impl From < & ClientTypeAttribute > for abci:: EventAttribute {
71
- fn from ( attr : & ClientTypeAttribute ) -> Self {
70
+ impl From < ClientTypeAttribute > for abci:: EventAttribute {
71
+ fn from ( attr : ClientTypeAttribute ) -> Self {
72
72
( CLIENT_TYPE_ATTRIBUTE_KEY , attr. client_type . as_str ( ) ) . into ( )
73
73
}
74
74
}
@@ -91,8 +91,8 @@ struct ConsensusHeightAttribute {
91
91
consensus_height : Height ,
92
92
}
93
93
94
- impl From < & ConsensusHeightAttribute > for abci:: EventAttribute {
95
- fn from ( attr : & ConsensusHeightAttribute ) -> Self {
94
+ impl From < ConsensusHeightAttribute > for abci:: EventAttribute {
95
+ fn from ( attr : ConsensusHeightAttribute ) -> Self {
96
96
( CONSENSUS_HEIGHT_ATTRIBUTE_KEY , attr. consensus_height ) . into ( )
97
97
}
98
98
}
@@ -115,11 +115,11 @@ struct ConsensusHeightsAttribute {
115
115
consensus_heights : Vec < Height > ,
116
116
}
117
117
118
- impl From < & ConsensusHeightsAttribute > for abci:: EventAttribute {
119
- fn from ( attr : & ConsensusHeightsAttribute ) -> Self {
118
+ impl From < ConsensusHeightsAttribute > for abci:: EventAttribute {
119
+ fn from ( attr : ConsensusHeightsAttribute ) -> Self {
120
120
let consensus_heights: Vec < String > = attr
121
121
. consensus_heights
122
- . iter ( )
122
+ . into_iter ( )
123
123
. map ( |consensus_height| consensus_height. to_string ( ) )
124
124
. collect ( ) ;
125
125
( CONSENSUS_HEIGHTS_ATTRIBUTE_KEY , consensus_heights. join ( "," ) ) . into ( )
@@ -144,11 +144,11 @@ struct HeaderAttribute {
144
144
header : Any ,
145
145
}
146
146
147
- impl From < & HeaderAttribute > for abci:: EventAttribute {
148
- fn from ( attr : & HeaderAttribute ) -> Self {
147
+ impl From < HeaderAttribute > for abci:: EventAttribute {
148
+ fn from ( attr : HeaderAttribute ) -> Self {
149
149
(
150
150
HEADER_ATTRIBUTE_KEY ,
151
- String :: from_utf8 ( hex:: encode ( & attr. header . value ) ) . unwrap ( ) ,
151
+ String :: from_utf8 ( hex:: encode ( attr. header . value ) ) . unwrap ( ) ,
152
152
)
153
153
. into ( )
154
154
}
@@ -197,14 +197,14 @@ impl CreateClient {
197
197
}
198
198
}
199
199
200
- impl From < & CreateClient > for abci:: Event {
201
- fn from ( c : & CreateClient ) -> Self {
200
+ impl From < CreateClient > for abci:: Event {
201
+ fn from ( c : CreateClient ) -> Self {
202
202
Self {
203
203
kind : IbcEventType :: CreateClient . as_str ( ) . to_owned ( ) ,
204
204
attributes : vec ! [
205
- abci :: EventAttribute :: from ( & c. client_id) ,
206
- abci :: EventAttribute :: from ( & c. client_type) ,
207
- abci :: EventAttribute :: from ( & c. consensus_height) ,
205
+ c. client_id. into ( ) ,
206
+ c. client_type. into ( ) ,
207
+ c. consensus_height. into ( ) ,
208
208
] ,
209
209
}
210
210
}
@@ -273,16 +273,16 @@ impl UpdateClient {
273
273
}
274
274
}
275
275
276
- impl From < & UpdateClient > for abci:: Event {
277
- fn from ( u : & UpdateClient ) -> Self {
276
+ impl From < UpdateClient > for abci:: Event {
277
+ fn from ( u : UpdateClient ) -> Self {
278
278
Self {
279
279
kind : IbcEventType :: UpdateClient . as_str ( ) . to_owned ( ) ,
280
280
attributes : vec ! [
281
- abci :: EventAttribute :: from ( & u. client_id) ,
282
- abci :: EventAttribute :: from ( & u. client_type) ,
283
- abci :: EventAttribute :: from ( & u. consensus_height) ,
284
- abci :: EventAttribute :: from ( & u. consensus_heights) ,
285
- abci :: EventAttribute :: from ( & u. header) ,
281
+ u. client_id. into ( ) ,
282
+ u. client_type. into ( ) ,
283
+ u. consensus_height. into ( ) ,
284
+ u. consensus_heights. into ( ) ,
285
+ u. header. into ( ) ,
286
286
] ,
287
287
}
288
288
}
@@ -326,14 +326,11 @@ impl ClientMisbehaviour {
326
326
}
327
327
}
328
328
329
- impl From < & ClientMisbehaviour > for abci:: Event {
330
- fn from ( c : & ClientMisbehaviour ) -> Self {
329
+ impl From < ClientMisbehaviour > for abci:: Event {
330
+ fn from ( c : ClientMisbehaviour ) -> Self {
331
331
Self {
332
332
kind : IbcEventType :: ClientMisbehaviour . as_str ( ) . to_owned ( ) ,
333
- attributes : vec ! [
334
- abci:: EventAttribute :: from( & c. client_id) ,
335
- abci:: EventAttribute :: from( & c. client_type) ,
336
- ] ,
333
+ attributes : vec ! [ c. client_id. into( ) , c. client_type. into( ) ] ,
337
334
}
338
335
}
339
336
}
@@ -381,14 +378,14 @@ impl UpgradeClient {
381
378
}
382
379
}
383
380
384
- impl From < & UpgradeClient > for abci:: Event {
385
- fn from ( u : & UpgradeClient ) -> Self {
381
+ impl From < UpgradeClient > for abci:: Event {
382
+ fn from ( u : UpgradeClient ) -> Self {
386
383
Self {
387
384
kind : IbcEventType :: UpgradeClient . as_str ( ) . to_owned ( ) ,
388
385
attributes : vec ! [
389
- abci :: EventAttribute :: from ( & u. client_id) ,
390
- abci :: EventAttribute :: from ( & u. client_type) ,
391
- abci :: EventAttribute :: from ( & u. consensus_height) ,
386
+ u. client_id. into ( ) ,
387
+ u. client_type. into ( ) ,
388
+ u. consensus_height. into ( ) ,
392
389
] ,
393
390
}
394
391
}
@@ -437,39 +434,34 @@ mod tests {
437
434
let tests: Vec < Test > = vec ! [
438
435
Test {
439
436
kind: IbcEventType :: CreateClient ,
440
- event: AbciEvent :: from( & CreateClient :: new(
441
- client_id. clone( ) ,
442
- client_type. clone( ) ,
443
- consensus_height,
444
- ) ) ,
437
+ event: CreateClient :: new( client_id. clone( ) , client_type. clone( ) , consensus_height)
438
+ . into( ) ,
445
439
expected_keys: expected_keys[ 0 ..3 ] . to_vec( ) ,
446
440
expected_values: expected_values[ 0 ..3 ] . to_vec( ) ,
447
441
} ,
448
442
Test {
449
443
kind: IbcEventType :: UpdateClient ,
450
- event: AbciEvent :: from ( & UpdateClient :: new(
444
+ event: UpdateClient :: new(
451
445
client_id. clone( ) ,
452
446
client_type. clone( ) ,
453
447
consensus_height,
454
448
consensus_heights,
455
449
header,
456
- ) ) ,
450
+ )
451
+ . into( ) ,
457
452
expected_keys: expected_keys. clone( ) ,
458
453
expected_values: expected_values. clone( ) ,
459
454
} ,
460
455
Test {
461
456
kind: IbcEventType :: UpgradeClient ,
462
- event: AbciEvent :: from( & UpgradeClient :: new(
463
- client_id. clone( ) ,
464
- client_type. clone( ) ,
465
- consensus_height,
466
- ) ) ,
457
+ event: UpgradeClient :: new( client_id. clone( ) , client_type. clone( ) , consensus_height)
458
+ . into( ) ,
467
459
expected_keys: expected_keys[ 0 ..3 ] . to_vec( ) ,
468
460
expected_values: expected_values[ 0 ..3 ] . to_vec( ) ,
469
461
} ,
470
462
Test {
471
463
kind: IbcEventType :: ClientMisbehaviour ,
472
- event: AbciEvent :: from ( & ClientMisbehaviour :: new( client_id, client_type) ) ,
464
+ event: ClientMisbehaviour :: new( client_id, client_type) . into ( ) ,
473
465
expected_keys: expected_keys[ 0 ..2 ] . to_vec( ) ,
474
466
expected_values: expected_values[ 0 ..2 ] . to_vec( ) ,
475
467
} ,
0 commit comments