Skip to content

Commit b0ba717

Browse files
committed
use reference in arguments
1 parent 53ec781 commit b0ba717

File tree

1 file changed

+73
-73
lines changed
  • ibc-eureka-core/ics24-host/types/src

1 file changed

+73
-73
lines changed

ibc-eureka-core/ics24-host/types/src/path.rs

Lines changed: 73 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -526,16 +526,16 @@ pub struct SeqSendPathV2 {
526526

527527
impl SeqSendPathV2 {
528528
pub fn new(
529-
source_client_on_target: ClientId,
530-
source_prefix: String,
531-
target_client_on_source: ClientId,
532-
target_prefix: String,
529+
source_client_on_target: &ClientId,
530+
source_prefix: &str,
531+
target_client_on_source: &ClientId,
532+
target_prefix: &str,
533533
) -> Self {
534534
Self {
535-
source_client_on_target,
536-
source_prefix,
537-
target_client_on_source,
538-
target_prefix,
535+
source_client_on_target: source_client_on_target.clone(),
536+
source_prefix: source_prefix.to_string(),
537+
target_client_on_source: target_client_on_source.clone(),
538+
target_prefix: target_prefix.to_string(),
539539
}
540540
}
541541
}
@@ -589,16 +589,16 @@ pub struct SeqRecvPathV2 {
589589

590590
impl SeqRecvPathV2 {
591591
pub fn new(
592-
source_client_on_target: ClientId,
593-
source_prefix: String,
594-
target_client_on_source: ClientId,
595-
target_prefix: String,
592+
source_client_on_target: &ClientId,
593+
source_prefix: &str,
594+
target_client_on_source: &ClientId,
595+
target_prefix: &str,
596596
) -> Self {
597597
Self {
598-
source_client_on_target,
599-
source_prefix,
600-
target_client_on_source,
601-
target_prefix,
598+
source_client_on_target: source_client_on_target.clone(),
599+
source_prefix: source_prefix.to_string(),
600+
target_client_on_source: target_client_on_source.clone(),
601+
target_prefix: target_prefix.to_string(),
602602
}
603603
}
604604
}
@@ -652,16 +652,16 @@ pub struct SeqAckPathV2 {
652652

653653
impl SeqAckPathV2 {
654654
pub fn new(
655-
source_client_on_target: ClientId,
656-
source_prefix: String,
657-
target_client_on_source: ClientId,
658-
target_prefix: String,
655+
source_client_on_target: &ClientId,
656+
source_prefix: &str,
657+
target_client_on_source: &ClientId,
658+
target_prefix: &str,
659659
) -> Self {
660660
Self {
661-
source_client_on_target,
662-
source_prefix,
663-
target_client_on_source,
664-
target_prefix,
661+
source_client_on_target: source_client_on_target.clone(),
662+
source_prefix: source_prefix.to_string(),
663+
target_client_on_source: target_client_on_source.clone(),
664+
target_prefix: target_prefix.to_string(),
665665
}
666666
}
667667
}
@@ -732,18 +732,18 @@ pub struct CommitmentPathV2 {
732732

733733
impl CommitmentPathV2 {
734734
pub fn new(
735-
source_client_on_target: ClientId,
736-
source_prefix: String,
737-
target_client_on_source: ClientId,
738-
target_prefix: String,
739-
sequence: Sequence,
735+
source_client_on_target: &ClientId,
736+
source_prefix: &str,
737+
target_client_on_source: &ClientId,
738+
target_prefix: &str,
739+
sequence: &Sequence,
740740
) -> Self {
741741
Self {
742-
source_client_on_target,
743-
source_prefix,
744-
target_client_on_source,
745-
target_prefix,
746-
sequence,
742+
source_client_on_target: source_client_on_target.clone(),
743+
source_prefix: source_prefix.to_string(),
744+
target_client_on_source: target_client_on_source.clone(),
745+
target_prefix: target_prefix.to_string(),
746+
sequence: *sequence,
747747
}
748748
}
749749

@@ -820,18 +820,18 @@ pub struct AckPathV2 {
820820

821821
impl AckPathV2 {
822822
pub fn new(
823-
source_client_on_target: ClientId,
824-
source_prefix: String,
825-
target_client_on_source: ClientId,
826-
target_prefix: String,
827-
sequence: Sequence,
823+
source_client_on_target: &ClientId,
824+
source_prefix: &str,
825+
target_client_on_source: &ClientId,
826+
target_prefix: &str,
827+
sequence: &Sequence,
828828
) -> Self {
829829
Self {
830-
source_client_on_target,
831-
source_prefix,
832-
target_client_on_source,
833-
target_prefix,
834-
sequence,
830+
source_client_on_target: source_client_on_target.clone(),
831+
source_prefix: source_prefix.to_string(),
832+
target_client_on_source: target_client_on_source.clone(),
833+
target_prefix: target_prefix.to_string(),
834+
sequence: *sequence,
835835
}
836836
}
837837

@@ -908,18 +908,18 @@ pub struct ReceiptPathV2 {
908908

909909
impl ReceiptPathV2 {
910910
pub fn new(
911-
source_client_on_target: ClientId,
912-
source_prefix: String,
913-
target_client_on_source: ClientId,
914-
target_prefix: String,
915-
sequence: Sequence,
911+
source_client_on_target: &ClientId,
912+
source_prefix: &str,
913+
target_client_on_source: &ClientId,
914+
target_prefix: &str,
915+
sequence: &Sequence,
916916
) -> Self {
917917
Self {
918-
source_client_on_target,
919-
source_prefix,
920-
target_client_on_source,
921-
target_prefix,
922-
sequence,
918+
source_client_on_target: source_client_on_target.clone(),
919+
source_prefix: source_prefix.to_string(),
920+
target_client_on_source: target_client_on_source.clone(),
921+
target_prefix: target_prefix.to_string(),
922+
sequence: *sequence,
923923
}
924924
}
925925

@@ -1378,34 +1378,34 @@ fn parse_commit_ack_receipt_seqs_v2(components: &[&str]) -> Option<Path> {
13781378
}
13791379

13801380
let source_client_on_target = ClientId::from_str(components[3]).ok()?;
1381-
let source_prefix = components[5].into();
1381+
let source_prefix = components[5];
13821382
let target_client_on_source = ClientId::from_str(components[7]).ok()?;
1383-
let target_prefix = components[9].into();
1383+
let target_prefix = components[9];
13841384

13851385
match components[1] {
13861386
NEXT_SEQ_SEND_PREFIX => Some(
13871387
SeqSendPathV2::new(
1388-
source_client_on_target,
1388+
&source_client_on_target,
13891389
source_prefix,
1390-
target_client_on_source,
1390+
&target_client_on_source,
13911391
target_prefix,
13921392
)
13931393
.into(),
13941394
),
13951395
NEXT_SEQ_RECV_PREFIX => Some(
13961396
SeqRecvPathV2::new(
1397-
source_client_on_target,
1397+
&source_client_on_target,
13981398
source_prefix,
1399-
target_client_on_source,
1399+
&target_client_on_source,
14001400
target_prefix,
14011401
)
14021402
.into(),
14031403
),
14041404
NEXT_SEQ_ACK_PREFIX => Some(
14051405
SeqAckPathV2::new(
1406-
source_client_on_target,
1406+
&source_client_on_target,
14071407
source_prefix,
1408-
target_client_on_source,
1408+
&target_client_on_source,
14091409
target_prefix,
14101410
)
14111411
.into(),
@@ -1437,39 +1437,39 @@ fn parse_commit_ack_receipt_v2(components: &[&str]) -> Option<Path> {
14371437
}
14381438

14391439
let source_client_on_target = ClientId::from_str(components[3]).ok()?;
1440-
let source_prefix = components[5].into();
1440+
let source_prefix = components[5];
14411441
let target_client_on_source = ClientId::from_str(components[7]).ok()?;
1442-
let target_prefix = components[9].into();
1442+
let target_prefix = components[9];
14431443
let sequence = Sequence::from_str(components[11]).ok()?;
14441444

14451445
match components[1] {
14461446
PACKET_COMMITMENT_PREFIX => Some(
14471447
CommitmentPathV2::new(
1448-
source_client_on_target,
1448+
&source_client_on_target,
14491449
source_prefix,
1450-
target_client_on_source,
1450+
&target_client_on_source,
14511451
target_prefix,
1452-
sequence,
1452+
&sequence,
14531453
)
14541454
.into(),
14551455
),
14561456
PACKET_ACK_PREFIX => Some(
14571457
AckPathV2::new(
1458-
source_client_on_target,
1458+
&source_client_on_target,
14591459
source_prefix,
1460-
target_client_on_source,
1460+
&target_client_on_source,
14611461
target_prefix,
1462-
sequence,
1462+
&sequence,
14631463
)
14641464
.into(),
14651465
),
14661466
PACKET_RECEIPT_PREFIX => Some(
14671467
ReceiptPathV2::new(
1468-
source_client_on_target,
1468+
&source_client_on_target,
14691469
source_prefix,
1470-
target_client_on_source,
1470+
&target_client_on_source,
14711471
target_prefix,
1472-
sequence,
1472+
&sequence,
14731473
)
14741474
.into(),
14751475
),

0 commit comments

Comments
 (0)