Skip to content

Commit db27986

Browse files
authored
Update rust toolchain (#514)
* Update toolchain to latest nightly * Implement Default with derive * Call Box::new directly instead of using a closure
1 parent 116b3e6 commit db27986

File tree

3 files changed

+7
-12
lines changed

3 files changed

+7
-12
lines changed

primitives/src/types.rs

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -197,9 +197,12 @@ impl DispatchClass {
197197
}
198198

199199
/// A destination account for payment.
200-
#[derive(PartialEq, Eq, Copy, Clone, Encode, Decode, RuntimeDebug, TypeInfo, MaxEncodedLen)]
200+
#[derive(
201+
PartialEq, Eq, Copy, Clone, Encode, Decode, RuntimeDebug, TypeInfo, MaxEncodedLen, Default,
202+
)]
201203
pub enum RewardDestination<AccountId> {
202204
/// Pay into the stash account, increasing the amount at stake accordingly.
205+
#[default]
203206
Staked,
204207
/// Pay into the stash account, not increasing the amount at stake.
205208
Stash,
@@ -211,12 +214,6 @@ pub enum RewardDestination<AccountId> {
211214
None,
212215
}
213216

214-
impl<AccountId> Default for RewardDestination<AccountId> {
215-
fn default() -> Self {
216-
RewardDestination::Staked
217-
}
218-
}
219-
220217
/// Health struct returned by the RPC
221218
// https://github.com/paritytech/substrate/blob/c172d0f683fab3792b90d876fd6ca27056af9fe9/client/rpc-api/src/system/helpers.rs#L40-L58
222219
#[derive(Debug, PartialEq, Serialize, Deserialize)]

rust-toolchain.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
[toolchain]
2-
channel = "nightly-2023-01-05"
2+
channel = "nightly-2023-04-03"
33
targets = ["wasm32-unknown-unknown"]
44
profile = "default" # include rustfmt, clippy

src/rpc/ws_client/mod.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -113,16 +113,14 @@ impl HandleMessage for SubscriptionHandler {
113113
let msg = &context.msg;
114114

115115
info!("got on_subscription_msg {}", msg);
116-
let value: serde_json::Value =
117-
serde_json::from_str(msg.as_text()?).map_err(|e| Box::new(e))?;
116+
let value: serde_json::Value = serde_json::from_str(msg.as_text()?).map_err(Box::new)?;
118117

119118
match value["id"].as_str() {
120119
Some(_idstr) => {
121120
warn!("Expected subscription, but received an id response instead: {:?}", value);
122121
},
123122
None => {
124-
let answer =
125-
serde_json::to_string(&value["params"]["result"]).map_err(|e| Box::new(e))?;
123+
let answer = serde_json::to_string(&value["params"]["result"]).map_err(Box::new)?;
126124

127125
if let Err(e) = result.send(answer) {
128126
// This may happen if the receiver has unsubscribed.

0 commit comments

Comments
 (0)