Skip to content

Commit ed6121c

Browse files
committed
Fix a round of compilation errors
1 parent c63a447 commit ed6121c

File tree

8 files changed

+12
-30
lines changed

8 files changed

+12
-30
lines changed

substrate/frame/staking/src/lib.rs

-18
Original file line numberDiff line numberDiff line change
@@ -1346,24 +1346,6 @@ impl<T: Config> Contains<T::AccountId> for AllStakers<T> {
13461346
}
13471347
}
13481348

1349-
/// A utility struct that provides a way to check if a given account is a staker.
1350-
///
1351-
/// This struct implements the `Contains` trait, allowing it to determine whether
1352-
/// a particular account is currently staking by checking if the account exists in
1353-
/// the staking ledger.
1354-
pub struct AllStakers<T: Config>(core::marker::PhantomData<T>);
1355-
1356-
impl<T: Config> Contains<T::AccountId> for AllStakers<T> {
1357-
/// Checks if the given account ID corresponds to a staker.
1358-
///
1359-
/// # Returns
1360-
/// - `true` if the account has an entry in the staking ledger (indicating it is staking).
1361-
/// - `false` otherwise.
1362-
fn contains(account: &T::AccountId) -> bool {
1363-
Ledger::<T>::contains_key(account)
1364-
}
1365-
}
1366-
13671349
/// Configurations of the benchmarking of the pallet.
13681350
pub trait BenchmarkingConfig {
13691351
/// The maximum number of validators to use.

substrate/frame/staking/src/pallet/mod.rs

+4-3
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,10 @@ pub use impls::*;
5353

5454
use crate::{
5555
asset, slashing, weights::WeightInfo, AccountIdLookupOf, ActiveEraInfo, BalanceOf, EraPayout,
56-
EraRewardPoints, ExposurePage, Forcing, LedgerIntegrityState, MaxNominationsOf,
57-
NegativeImbalanceOf, Nominations, NominationsQuota, PositiveImbalanceOf, RewardDestination,
58-
SessionInterface, StakingLedger, UnappliedSlash, UnlockChunk, ValidatorPrefs,
56+
EraRewardPoints, Exposure, ExposurePage, Forcing, LedgerIntegrityState, MaxNominationsOf,
57+
NegativeImbalanceOf, Nominations, NominationsQuota, OffenceSeverity, PositiveImbalanceOf,
58+
RewardDestination, SessionInterface, StakingLedger, UnappliedSlash, UnlockChunk,
59+
ValidatorPrefs,
5960
};
6061

6162
// The speculative number of spans are used as an input of the weight annotation of

substrate/frame/staking/src/slashing.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,7 @@ fn kick_out_if_recent<T: Config>(params: SlashParams<T>) {
314314
// Check https://github.com/paritytech/polkadot-sdk/issues/2650 for details
315315
spans.end_span(params.now);
316316
}
317-
317+
}
318318

319319
/// Slash nominators. Accepts general parameters and the prior slash percentage of the validator.
320320
///

substrate/frame/staking/src/weights.rs

+1-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

substrate/primitives/npos-elections/src/helpers.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ where
5050
{
5151
let mut staked = assignment_ratio_to_staked(ratio, &stake_of);
5252
staked.iter_mut().try_for_each(|a| {
53-
a.try_normalize(stake_of(&a.who).into()).map_err(Error::ArithmeticError)
53+
a.try_normalize(stake_of(&a.who).into()).map_err(|_| Error::ArithmeticError)
5454
})?;
5555
Ok(staked)
5656
}
@@ -70,7 +70,7 @@ pub fn assignment_staked_to_ratio_normalized<A: IdentifierT, P: PerThing128>(
7070
) -> Result<Vec<Assignment<A, P>>, Error> {
7171
let mut ratio = staked.into_iter().map(|a| a.into_assignment()).collect::<Vec<_>>();
7272
for assignment in ratio.iter_mut() {
73-
assignment.try_normalize().map_err(Error::ArithmeticError)?;
73+
assignment.try_normalize().map_err(|_| Error::ArithmeticError)?;
7474
}
7575
Ok(ratio)
7676
}

substrate/primitives/npos-elections/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ pub enum Error {
131131
/// One of the page indices was invalid.
132132
SolutionInvalidPageIndex,
133133
/// An error occurred in some arithmetic operation.
134-
ArithmeticError(&'static str),
134+
ArithmeticError,
135135
/// The data provided to create support map was invalid.
136136
InvalidSupportEdge,
137137
/// The number of voters is bigger than the `MaxVoters` bound.

substrate/primitives/npos-elections/src/phragmen.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ pub fn seq_phragmen<AccountId: IdentifierT, P: PerThing128>(
9797
voters.into_iter().filter_map(|v| v.into_assignment()).collect::<Vec<_>>();
9898
let _ = assignments
9999
.iter_mut()
100-
.try_for_each(|a| a.try_normalize().map_err(crate::Error::ArithmeticError))?;
100+
.try_for_each(|a| a.try_normalize().map_err(|_| crate::Error::ArithmeticError))?;
101101
let winners = winners
102102
.into_iter()
103103
.map(|w_ptr| (w_ptr.borrow().who.clone(), w_ptr.borrow().backed_stake))
@@ -205,7 +205,7 @@ pub fn seq_phragmen_core<AccountId: IdentifierT>(
205205
// edge of all candidates that eventually have a non-zero weight must be elected.
206206
debug_assert!(voter.edges.iter().all(|e| e.candidate.borrow().elected));
207207
// inc budget to sum the budget.
208-
voter.try_normalize_elected().map_err(crate::Error::ArithmeticError)?;
208+
voter.try_normalize_elected().map_err(|_| crate::Error::ArithmeticError)?;
209209
}
210210

211211
Ok((candidates, voters))

substrate/primitives/npos-elections/src/phragmms.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ pub fn phragmms<AccountId: IdentifierT, P: PerThing128>(
7171
let _ = assignments
7272
.iter_mut()
7373
.try_for_each(|a| a.try_normalize())
74-
.map_err(crate::Error::ArithmeticError)?;
74+
.map_err(|_| crate::Error::ArithmeticError)?;
7575
let winners = winners
7676
.into_iter()
7777
.map(|w_ptr| (w_ptr.borrow().who.clone(), w_ptr.borrow().backed_stake))

0 commit comments

Comments
 (0)