Skip to content

Commit 698146a

Browse files
authored
Fix various clippy and compilation warnings (#442)
In my previous commit I’ve introduced a new build warning. Motivation for this commit was to fix it and while I’m at it address some other issues as well. However, turns out there’s too many warnings I care to deal with so this addresses only some of the warnings.
1 parent f1b4b27 commit 698146a

File tree

23 files changed

+106
-113
lines changed

23 files changed

+106
-113
lines changed

contracts/pallet-ibc/docs/routing.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ pub struct IbcModule<T: Config>(PhantomData<T>);
4444

4545
impl<T: Config> Default for IbcModule<T> {
4646
fn default() -> Self {
47-
Self(PhantomData::default())
47+
Self(PhantomData)
4848
}
4949
}
5050

@@ -214,7 +214,7 @@ impl<T: Config + Send + Sync> Module for IbcModule<T> {
214214
pub struct WeightHandler<T: Config>(PhantomData<T>);
215215
impl<T: Config> Default for WeightHandler<T> {
216216
fn default() -> Self {
217-
Self(PhantomData::default())
217+
Self(PhantomData)
218218
}
219219
}
220220

contracts/pallet-ibc/ping/src/lib.rs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ pub struct IbcModule<T: Config>(PhantomData<T>);
139139

140140
impl<T: Config> Default for IbcModule<T> {
141141
fn default() -> Self {
142-
Self(PhantomData::default())
142+
Self(PhantomData)
143143
}
144144
}
145145

@@ -305,48 +305,48 @@ impl<T: Config + Send + Sync> Module for IbcModule<T> {
305305
pub struct WeightHandler<T: Config>(PhantomData<T>);
306306
impl<T: Config> Default for WeightHandler<T> {
307307
fn default() -> Self {
308-
Self(PhantomData::default())
308+
Self(PhantomData)
309309
}
310310
}
311311

312312
impl<T: Config> CallbackWeight for WeightHandler<T> {
313313
fn on_chan_open_init(&self) -> Weight {
314-
Weight::from_ref_time(0)
314+
Weight::default()
315315
}
316316

317317
fn on_chan_open_try(&self) -> Weight {
318-
Weight::from_ref_time(0)
318+
Weight::default()
319319
}
320320

321321
fn on_chan_open_ack(&self, _port_id: &PortId, _channel_id: &ChannelId) -> Weight {
322-
Weight::from_ref_time(0)
322+
Weight::default()
323323
}
324324

325325
fn on_chan_open_confirm(&self, _port_id: &PortId, _channel_id: &ChannelId) -> Weight {
326-
Weight::from_ref_time(0)
326+
Weight::default()
327327
}
328328

329329
fn on_chan_close_init(&self, _port_id: &PortId, _channel_id: &ChannelId) -> Weight {
330-
Weight::from_ref_time(0)
330+
Weight::default()
331331
}
332332

333333
fn on_chan_close_confirm(&self, _port_id: &PortId, _channel_id: &ChannelId) -> Weight {
334-
Weight::from_ref_time(0)
334+
Weight::default()
335335
}
336336

337337
fn on_recv_packet(&self, _packet: &Packet) -> Weight {
338-
Weight::from_ref_time(0)
338+
Weight::default()
339339
}
340340

341341
fn on_acknowledgement_packet(
342342
&self,
343343
_packet: &Packet,
344344
_acknowledgement: &Acknowledgement,
345345
) -> Weight {
346-
Weight::from_ref_time(0)
346+
Weight::default()
347347
}
348348

349349
fn on_timeout_packet(&self, _packet: &Packet) -> Weight {
350-
Weight::from_ref_time(0)
350+
Weight::default()
351351
}
352352
}

contracts/pallet-ibc/src/client.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,8 +125,7 @@ where
125125
let cs_state = consensus_heights
126126
.into_iter()
127127
.filter(|prev_height| prev_height < &height)
128-
.rev()
129-
.next()
128+
.next_back()
130129
.and_then(|prev_height| self.consensus_state(client_id, prev_height).ok());
131130
Ok(cs_state)
132131
}

contracts/pallet-ibc/src/ics20/mod.rs

Lines changed: 22 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ pub struct IbcModule<T: Config>(PhantomData<T>);
5454

5555
impl<T: Config> Default for IbcModule<T> {
5656
fn default() -> Self {
57-
Self(PhantomData::default())
57+
Self(PhantomData)
5858
}
5959
}
6060

@@ -468,7 +468,7 @@ pub struct WeightHandler<T: Config>(PhantomData<T>);
468468

469469
impl<T: Config> Default for WeightHandler<T> {
470470
fn default() -> Self {
471-
Self(PhantomData::default())
471+
Self(PhantomData)
472472
}
473473
}
474474

@@ -640,27 +640,26 @@ pub enum MemoType {
640640
impl Forward {
641641
pub fn get_memo(&self) -> Result<MemoType, Ics20Error> {
642642
if self.substrate.unwrap_or_default() {
643-
let xcm = MemoXcm { receiver: self.receiver.clone(), para_id: self.para_id.clone() };
643+
let xcm = MemoXcm { receiver: self.receiver.clone(), para_id: self.para_id };
644644
return Ok(MemoType::XCM(xcm))
645645
}
646-
let ibc =
647-
MemoIbc {
648-
receiver: self.receiver.clone(),
649-
port: self
650-
.port
651-
.clone()
652-
.ok_or(Ics20Error::implementation_specific("Failed to get port".to_string()))?,
653-
channel: self.channel.clone().ok_or(Ics20Error::implementation_specific(
654-
"Failed to get channel".to_string(),
655-
))?,
656-
timeout: self.timeout.clone().ok_or(Ics20Error::implementation_specific(
657-
"Failed to get timeout".to_string(),
658-
))?,
659-
retries: self.retries.clone().ok_or(Ics20Error::implementation_specific(
660-
"Failed to get retries".to_string(),
661-
))?,
662-
};
663-
return Ok(MemoType::IBC(ibc))
646+
Ok(MemoType::IBC(MemoIbc {
647+
receiver: self.receiver.clone(),
648+
port: self
649+
.port
650+
.clone()
651+
.ok_or(Ics20Error::implementation_specific("Failed to get port".to_string()))?,
652+
channel: self
653+
.channel
654+
.clone()
655+
.ok_or(Ics20Error::implementation_specific("Failed to get channel".to_string()))?,
656+
timeout: self
657+
.timeout
658+
.ok_or(Ics20Error::implementation_specific("Failed to get timeout".to_string()))?,
659+
retries: self
660+
.retries
661+
.ok_or(Ics20Error::implementation_specific("Failed to get retries".to_string()))?,
662+
}))
664663
}
665664
}
666665

@@ -800,7 +799,7 @@ where
800799
to: account_to.clone(),
801800
para_id: memo_forward.para_id,
802801
amount,
803-
asset_id: asset_id.clone().into(),
802+
asset_id: asset_id.clone(),
804803
});
805804
Ics20Error::implementation_specific(
806805
"Faield to execute SubstrateMultihopXcmHandler::transfer_xcm.".to_string(),
@@ -812,7 +811,7 @@ where
812811
to: account_to.clone(),
813812
para_id: memo_forward.para_id,
814813
amount,
815-
asset_id: asset_id.clone().into(),
814+
asset_id: asset_id.clone(),
816815
});
817816

818817
return Ok(())

contracts/pallet-ibc/src/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
overflowing_literals,
1515
path_statements,
1616
patterns_in_fns_without_body,
17-
private_in_public,
1817
unconditional_recursion,
1918
unused_allocation,
2019
unused_comparisons,

contracts/pallet-ibc/src/routing.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ pub(crate) struct Context<T: Config> {
2020

2121
impl<T: Config + Send + Sync> Default for Context<T> {
2222
fn default() -> Self {
23-
Self { _pd: PhantomData::default(), router: IbcRouter::default() }
23+
Self { _pd: PhantomData, router: IbcRouter::default() }
2424
}
2525
}
2626

contracts/pallet-ibc/src/weight.rs

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -46,111 +46,111 @@ pub trait WeightInfo {
4646

4747
impl WeightInfo for () {
4848
fn create_client() -> Weight {
49-
Weight::from_ref_time(0)
49+
Weight::default()
5050
}
5151

5252
fn conn_open_init() -> Weight {
53-
Weight::from_ref_time(0)
53+
Weight::default()
5454
}
5555

5656
fn update_tendermint_client(i: u32) -> Weight {
57-
Weight::from_ref_time(3 * i as u64 * WEIGHT_REF_TIME_PER_MILLIS)
57+
Weight::from_parts(3 * i as u64 * WEIGHT_REF_TIME_PER_MILLIS, 0)
5858
}
5959

6060
fn conn_try_open_tendermint() -> Weight {
61-
Weight::from_ref_time(0)
61+
Weight::default()
6262
}
6363

6464
fn conn_open_ack_tendermint() -> Weight {
65-
Weight::from_ref_time(0)
65+
Weight::default()
6666
}
6767

6868
fn conn_open_confirm_tendermint() -> Weight {
69-
Weight::from_ref_time(0)
69+
Weight::default()
7070
}
7171

7272
fn channel_open_init() -> Weight {
73-
Weight::from_ref_time(0)
73+
Weight::default()
7474
}
7575

7676
fn channel_open_try_tendermint() -> Weight {
77-
Weight::from_ref_time(0)
77+
Weight::default()
7878
}
7979

8080
fn channel_open_ack_tendermint() -> Weight {
81-
Weight::from_ref_time(0)
81+
Weight::default()
8282
}
8383

8484
fn channel_open_confirm_tendermint() -> Weight {
85-
Weight::from_ref_time(0)
85+
Weight::default()
8686
}
8787

8888
fn channel_close_init() -> Weight {
89-
Weight::from_ref_time(0)
89+
Weight::default()
9090
}
9191

9292
fn channel_close_confirm_tendermint() -> Weight {
93-
Weight::from_ref_time(0)
93+
Weight::default()
9494
}
9595

9696
fn recv_packet_tendermint(_i: u32) -> Weight {
97-
Weight::from_ref_time(0)
97+
Weight::default()
9898
}
9999

100100
fn ack_packet_tendermint(_i: u32, _j: u32) -> Weight {
101-
Weight::from_ref_time(0)
101+
Weight::default()
102102
}
103103

104104
fn timeout_packet_tendermint(_i: u32) -> Weight {
105-
Weight::from_ref_time(0)
105+
Weight::default()
106106
}
107107

108108
fn transfer() -> Weight {
109-
Weight::from_ref_time(0)
109+
Weight::default()
110110
}
111111

112112
fn on_chan_open_init() -> Weight {
113-
Weight::from_ref_time(0)
113+
Weight::default()
114114
}
115115

116116
fn on_chan_open_try() -> Weight {
117-
Weight::from_ref_time(0)
117+
Weight::default()
118118
}
119119

120120
fn on_recv_packet() -> Weight {
121-
Weight::from_ref_time(0)
121+
Weight::default()
122122
}
123123

124124
fn on_chan_open_ack() -> Weight {
125-
Weight::from_ref_time(0)
125+
Weight::default()
126126
}
127127

128128
fn on_chan_open_confirm() -> Weight {
129-
Weight::from_ref_time(0)
129+
Weight::default()
130130
}
131131

132132
fn on_chan_close_init() -> Weight {
133-
Weight::from_ref_time(0)
133+
Weight::default()
134134
}
135135

136136
fn on_chan_close_confirm() -> Weight {
137-
Weight::from_ref_time(0)
137+
Weight::default()
138138
}
139139

140140
fn on_acknowledgement_packet() -> Weight {
141-
Weight::from_ref_time(0)
141+
Weight::default()
142142
}
143143

144144
fn on_timeout_packet() -> Weight {
145-
Weight::from_ref_time(0)
145+
Weight::default()
146146
}
147147

148148
fn update_grandpa_client(_i: u32, _j: u32) -> Weight {
149-
Weight::from_ref_time(0)
149+
Weight::default()
150150
}
151151

152152
fn packet_cleanup(_i: u32) -> Weight {
153-
Weight::from_ref_time(0)
153+
Weight::default()
154154
}
155155
}
156156

hyperspace/core/src/substrate/default.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ use self::parachain_subxt::api::{
1111
};
1212
use super::{unimplemented, DummyBeefyAuthoritySet};
1313
use crate::{
14-
define_any_wrapper, define_beefy_authority_set, define_event_record, define_events,
15-
define_head_data, define_ibc_event_wrapper, define_id, define_para_lifecycle,
16-
define_runtime_call, define_runtime_event, define_runtime_storage, define_runtime_transactions,
14+
define_any_wrapper, define_event_record, define_events, define_head_data,
15+
define_ibc_event_wrapper, define_id, define_para_lifecycle, define_runtime_call,
16+
define_runtime_event, define_runtime_storage, define_runtime_transactions,
1717
define_send_ping_params, define_transfer_params,
1818
};
1919
use async_trait::async_trait;

0 commit comments

Comments
 (0)