Skip to content

Commit ec84de5

Browse files
committed
use into() instead of ::from()
1 parent cd2addd commit ec84de5

File tree

15 files changed

+46
-53
lines changed

15 files changed

+46
-53
lines changed

ibc-apps/ics721-nft-transfer/src/handler/send_transfer.rs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
use ibc_app_nft_transfer_types::Memo;
21
use ibc_core::channel::context::{SendPacketExecutionContext, SendPacketValidationContext};
32
use ibc_core::channel::handler::{send_packet_execute, send_packet_validate};
43
use ibc_core::channel::types::packet::Packet;
@@ -82,14 +81,14 @@ where
8281
&msg.chan_id_on_a,
8382
class_id,
8483
token_id,
85-
&packet_data.memo.clone().unwrap_or(Memo::from("")),
84+
&packet_data.memo.clone().unwrap_or("".into()),
8685
)?;
8786
} else {
8887
transfer_ctx.burn_nft_validate(
8988
&sender,
9089
class_id,
9190
token_id,
92-
&packet_data.memo.clone().unwrap_or(Memo::from("")),
91+
&packet_data.memo.clone().unwrap_or("".into()),
9392
)?;
9493
}
9594
let nft = transfer_ctx.get_nft(class_id, token_id)?;
@@ -185,14 +184,14 @@ where
185184
&msg.chan_id_on_a,
186185
class_id,
187186
token_id,
188-
&packet_data.memo.clone().unwrap_or(Memo::from("")),
187+
&packet_data.memo.clone().unwrap_or("".into()),
189188
)?;
190189
} else {
191190
transfer_ctx.burn_nft_execute(
192191
&sender,
193192
class_id,
194193
token_id,
195-
&packet_data.memo.clone().unwrap_or(Memo::from("")),
194+
&packet_data.memo.clone().unwrap_or("".into()),
196195
)?;
197196
}
198197
let nft = transfer_ctx.get_nft(class_id, token_id)?;
@@ -243,7 +242,7 @@ where
243242
receiver: packet_data.receiver,
244243
class: packet_data.class_id,
245244
tokens: packet_data.token_ids,
246-
memo: packet_data.memo.unwrap_or(Memo::from("")),
245+
memo: packet_data.memo.unwrap_or("".into()),
247246
};
248247
send_packet_ctx_a.emit_ibc_event(ModuleEvent::from(transfer_event).into())?;
249248

ibc-apps/ics721-nft-transfer/src/module.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
//! Provides IBC module callbacks implementation for the ICS-721 transfer.
2-
3-
use ibc_app_nft_transfer_types::Memo;
42
use ibc_core::channel::types::acknowledgement::{Acknowledgement, AcknowledgementStatus};
53
use ibc_core::channel::types::channel::{Counterparty, Order};
64
use ibc_core::channel::types::packet::Packet;
@@ -195,7 +193,7 @@ pub fn on_recv_packet_execute(
195193
receiver: data.receiver,
196194
class: data.class_id,
197195
tokens: data.token_ids,
198-
memo: data.memo.unwrap_or(Memo::from("")),
196+
memo: data.memo.unwrap_or("".into()),
199197
success: ack.is_successful(),
200198
};
201199
extras.events.push(recv_event.into());
@@ -260,7 +258,7 @@ pub fn on_acknowledgement_packet_execute(
260258
receiver: data.receiver,
261259
class: data.class_id,
262260
tokens: data.token_ids,
263-
memo: data.memo.unwrap_or(Memo::from("")),
261+
memo: data.memo.unwrap_or("".into()),
264262
acknowledgement: acknowledgement.clone(),
265263
};
266264

@@ -308,7 +306,7 @@ pub fn on_timeout_packet_execute(
308306
refund_receiver: data.sender,
309307
refund_class: data.class_id,
310308
refund_tokens: data.token_ids,
311-
memo: data.memo.unwrap_or(Memo::from("")),
309+
memo: data.memo.unwrap_or("".into()),
312310
};
313311

314312
let extras = ModuleExtras {

ibc-core/ics03-connection/types/src/connection.rs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -210,12 +210,8 @@ impl TryFrom<RawConnectionEnd> for ConnectionEnd {
210210
if state == State::Uninitialized {
211211
return ConnectionEnd::new(
212212
State::Uninitialized,
213-
ClientId::from("07-tendermint-0"),
214-
Counterparty::new(
215-
ClientId::from("07-tendermint-0"),
216-
None,
217-
CommitmentPrefix::empty(),
218-
),
213+
"07-tendermint-0".into(),
214+
Counterparty::new("07-tendermint-0".into(), None, CommitmentPrefix::empty()),
219215
Vec::new(),
220216
ZERO_DURATION,
221217
);

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

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1182,35 +1182,35 @@ mod tests {
11821182
)]
11831183
#[case(
11841184
"clients/07-tendermint-0/clientState",
1185-
Path::ClientState(ClientStatePath(ClientId::from("07-tendermint-0")))
1185+
Path::ClientState(ClientStatePath("07-tendermint-0".into()))
11861186
)]
11871187
#[case(
11881188
"clients/07-tendermint-0/consensusStates/15-31",
11891189
Path::ClientConsensusState(ClientConsensusStatePath {
1190-
client_id: ClientId::from("07-tendermint-0"),
1190+
client_id: "07-tendermint-0".into(),
11911191
revision_number: 15,
11921192
revision_height: 31,
11931193
})
11941194
)]
11951195
#[case(
11961196
"clients/07-tendermint-0/consensusStates/15-31/processedTime",
11971197
Path::ClientUpdateTime(ClientUpdateTimePath {
1198-
client_id: ClientId::from("07-tendermint-0"),
1198+
client_id: "07-tendermint-0".into(),
11991199
revision_number: 15,
12001200
revision_height: 31,
12011201
})
12021202
)]
12031203
#[case(
12041204
"clients/07-tendermint-0/consensusStates/15-31/processedHeight",
12051205
Path::ClientUpdateHeight(ClientUpdateHeightPath {
1206-
client_id: ClientId::from("07-tendermint-0"),
1206+
client_id: "07-tendermint-0".into(),
12071207
revision_number: 15,
12081208
revision_height: 31,
12091209
})
12101210
)]
12111211
#[case(
12121212
"clients/07-tendermint-0/connections",
1213-
Path::ClientConnection(ClientConnectionPath(ClientId::from("07-tendermint-0")))
1213+
Path::ClientConnection(ClientConnectionPath("07-tendermint-0".into()))
12141214
)]
12151215
#[case(
12161216
"connections/connection-0",
@@ -1299,7 +1299,7 @@ mod tests {
12991299
assert_eq!(
13001300
parse_client_paths(&components),
13011301
Some(Path::ClientConsensusState(ClientConsensusStatePath {
1302-
client_id: ClientId::from("07-tendermint-0"),
1302+
client_id: "07-tendermint-0".into(),
13031303
revision_number: 15,
13041304
revision_height: 31,
13051305
}))
@@ -1314,7 +1314,7 @@ mod tests {
13141314
assert_eq!(
13151315
parse_client_paths(&components),
13161316
Some(Path::ClientUpdateTime(ClientUpdateTimePath {
1317-
client_id: ClientId::from("07-tendermint-0"),
1317+
client_id: "07-tendermint-0".into(),
13181318
revision_number: 15,
13191319
revision_height: 31,
13201320
}))
@@ -1326,7 +1326,7 @@ mod tests {
13261326
assert_eq!(
13271327
parse_client_paths(&components),
13281328
Some(Path::ClientUpdateHeight(ClientUpdateHeightPath {
1329-
client_id: ClientId::from("07-tendermint-0"),
1329+
client_id: "07-tendermint-0".into(),
13301330
revision_number: 15,
13311331
revision_height: 31,
13321332
}))

ibc-testkit/src/fixtures/applications/transfer.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ pub struct PacketDataConfig {
6161
pub sender: Signer,
6262
#[builder(default = dummy_account_id())]
6363
pub receiver: Signer,
64-
#[builder(default = Memo::from(""))]
64+
#[builder(default = "".into())]
6565
pub memo: Memo,
6666
}
6767

ibc-testkit/src/fixtures/core/connection/conn_open_init.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ pub fn msg_conn_open_with_version(
7171
/// Returns a dummy `RawMsgConnectionOpenInit`, for testing purposes only!
7272
pub fn dummy_raw_msg_conn_open_init() -> RawMsgConnectionOpenInit {
7373
RawMsgConnectionOpenInit {
74-
client_id: ClientId::from("07-tendermint-0").to_string(),
74+
client_id: "07-tendermint-0".to_string(),
7575
counterparty: Some(dummy_raw_counterparty_conn(None)),
7676
version: Some(get_compatible_versions()[0].clone().into()),
7777
delay_period: 0,

ibc-testkit/src/fixtures/core/connection/conn_open_try.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ pub fn dummy_raw_msg_conn_open_try(
4040

4141
#[allow(deprecated)]
4242
RawMsgConnectionOpenTry {
43-
client_id: ClientId::from("07-tendermint-0").to_string(),
43+
client_id: "07-tendermint-0".to_string(),
4444
previous_connection_id: ConnectionId::zero().to_string(),
4545
client_state: Some(MockClientState::new(MockHeader::new(client_state_height)).into()),
4646
counterparty: Some(dummy_raw_counterparty_conn(Some(0))),

ibc-testkit/src/fixtures/core/connection/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ pub use conn_open_init::*;
99
pub use conn_open_try::*;
1010
use ibc::core::commitment_types::proto::v1::MerklePrefix;
1111
use ibc::core::connection::types::proto::v1::Counterparty as RawCounterparty;
12-
use ibc::core::host::types::identifiers::{ClientId, ConnectionId};
12+
use ibc::core::host::types::identifiers::ConnectionId;
1313
use ibc::core::primitives::prelude::*;
1414
use typed_builder::TypedBuilder;
1515

@@ -42,7 +42,7 @@ pub fn dummy_raw_counterparty_conn(conn_id: Option<u64>) -> RawCounterparty {
4242
None => "".to_string(),
4343
};
4444
RawCounterparty {
45-
client_id: ClientId::from("07-tendermint-0").to_string(),
45+
client_id: "07-tendermint-0".to_string(),
4646
connection_id,
4747
prefix: Some(MerklePrefix {
4848
key_prefix: b"ibc".to_vec(),

ibc-testkit/src/testapp/ibc/clients/mock/misbehaviour.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ impl TryFrom<RawMisbehaviour> for Misbehaviour {
2323

2424
fn try_from(raw: RawMisbehaviour) -> Result<Self, Self::Error> {
2525
Ok(Self {
26-
client_id: ClientId::from("07-tendermint-0"),
26+
client_id: "07-tendermint-0".into(),
2727
header1: raw
2828
.header1
2929
.ok_or(ClientError::MissingRawMisbehaviour)?

ibc-testkit/src/testapp/ibc/core/types.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ pub struct MockContext {
125125
pub struct MockClientConfig {
126126
#[builder(default = ChainId::new("mockZ-1").expect("no error"))]
127127
client_chain_id: ChainId,
128-
#[builder(default = ClientId::from("07-tendermint-0"))]
128+
#[builder(default = "07-tendermint-0".into())]
129129
client_id: ClientId,
130130
#[builder(default = mock_client_type())]
131131
client_type: ClientType,

0 commit comments

Comments
 (0)