mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-12 08:51:09 +00:00
Switch to Rust 2021 (#10170)
* Switch to Rust 2021 * Update trybuild to fix errors
This commit is contained in:
@@ -926,7 +926,6 @@ impl<T: Config> ElectionDataProvider<T::AccountId, BlockNumberFor<T>> for Pallet
|
||||
|
||||
#[cfg(feature = "runtime-benchmarks")]
|
||||
fn add_voter(voter: T::AccountId, weight: VoteWeight, targets: Vec<T::AccountId>) {
|
||||
use sp_std::convert::TryFrom;
|
||||
let stake = <BalanceOf<T>>::try_from(weight).unwrap_or_else(|_| {
|
||||
panic!("cannot convert a VoteWeight into BalanceOf, benchmark needs reconfiguring.")
|
||||
});
|
||||
@@ -981,7 +980,6 @@ impl<T: Config> ElectionDataProvider<T::AccountId, BlockNumberFor<T>> for Pallet
|
||||
targets: Vec<T::AccountId>,
|
||||
target_stake: Option<VoteWeight>,
|
||||
) {
|
||||
use sp_std::convert::TryFrom;
|
||||
targets.into_iter().for_each(|v| {
|
||||
let stake: BalanceOf<T> = target_stake
|
||||
.and_then(|w| <BalanceOf<T>>::try_from(w).ok())
|
||||
@@ -1256,7 +1254,6 @@ impl<T: Config> VoteWeightProvider<T::AccountId> for Pallet<T> {
|
||||
fn set_vote_weight_of(who: &T::AccountId, weight: VoteWeight) {
|
||||
// this will clearly results in an inconsistent state, but it should not matter for a
|
||||
// benchmark.
|
||||
use sp_std::convert::TryInto;
|
||||
let active: BalanceOf<T> = weight.try_into().map_err(|_| ()).unwrap();
|
||||
let mut ledger = Self::ledger(who).unwrap_or_default();
|
||||
ledger.active = active;
|
||||
|
||||
Reference in New Issue
Block a user