diff --git a/pallets/attestation/src/mock.rs b/pallets/attestation/src/mock.rs index 8b0d75226b..3eb90fdbb3 100644 --- a/pallets/attestation/src/mock.rs +++ b/pallets/attestation/src/mock.rs @@ -291,6 +291,7 @@ pub(crate) mod runtime { } impl ExtBuilder { + #[must_use] pub fn with_delegation_hierarchies( mut self, delegation_hierarchies: DelegationHierarchyInitialization, @@ -299,21 +300,25 @@ pub(crate) mod runtime { self } + #[must_use] pub fn with_delegations(mut self, delegations: Vec<(TestDelegationNodeId, DelegationNode)>) -> Self { self.delegations = delegations; self } + #[must_use] pub fn with_ctypes(mut self, ctypes: Vec<(TestCtypeHash, CtypeCreatorOf)>) -> Self { self.ctypes = ctypes; self } + #[must_use] pub fn with_balances(mut self, balances: Vec<(AccountIdOf, BalanceOf)>) -> Self { self.balances = balances; self } + #[must_use] pub fn with_attestations(mut self, attestations: Vec<(TestClaimHash, AttestationDetails)>) -> Self { self.attestations = attestations; self diff --git a/pallets/delegation/src/mock.rs b/pallets/delegation/src/mock.rs index 8167aeb284..6be1a55f55 100644 --- a/pallets/delegation/src/mock.rs +++ b/pallets/delegation/src/mock.rs @@ -412,6 +412,7 @@ pub mod runtime { } impl ExtBuilder { + #[must_use] pub fn with_delegation_hierarchies( mut self, delegation_hierarchies: DelegationHierarchyInitialization, @@ -420,16 +421,19 @@ pub mod runtime { self } + #[must_use] pub fn with_balances(mut self, balances: Vec<(AccountIdOf, BalanceOf)>) -> Self { self.balances = balances; self } + #[must_use] pub fn with_ctypes(mut self, ctypes: Vec<(TestCtypeHash, SubjectId)>) -> Self { self.ctypes = ctypes; self } + #[must_use] pub fn with_delegations(mut self, delegations: Vec<(TestDelegationNodeId, DelegationNode)>) -> Self { self.delegations_stored = delegations; self diff --git a/pallets/parachain-staking/src/lib.rs b/pallets/parachain-staking/src/lib.rs index bca68d2188..dabc1bdcd0 100644 --- a/pallets/parachain-staking/src/lib.rs +++ b/pallets/parachain-staking/src/lib.rs @@ -1485,7 +1485,7 @@ pub mod pallet { ensure!(amount >= T::MinDelegatorStake::get(), Error::::NomStakeBelowMin); // cannot be a collator candidate and delegator with same AccountId - ensure!(!Self::is_active_candidate(&acc).is_some(), Error::::CandidateExists); + ensure!(Self::is_active_candidate(&acc).is_none(), Error::::CandidateExists); ensure!( Unstaking::::get(&acc).len().saturated_into::() < T::MaxUnstakeRequests::get(), Error::::CannotJoinBeforeUnlocking @@ -2139,8 +2139,7 @@ pub mod pallet { ) -> Option<(BalanceOf, BalanceOf)> { top_candidates .get(index) - .map(|stake| CandidatePool::::get(&stake.owner)) - .flatten() + .and_then(|stake| CandidatePool::::get(&stake.owner)) // SAFETY: the total is always more than the stake .map(|state| (state.stake, state.total - state.stake)) } diff --git a/pallets/parachain-staking/src/tests.rs b/pallets/parachain-staking/src/tests.rs index 8a1f3baefe..f9ead1d482 100644 --- a/pallets/parachain-staking/src/tests.rs +++ b/pallets/parachain-staking/src/tests.rs @@ -887,7 +887,7 @@ fn execute_leave_candidates_with_delay() { *collator )); assert!(StakePallet::candidate_pool(&collator).is_none()); - assert!(!StakePallet::is_active_candidate(collator).is_some()); + assert!(StakePallet::is_active_candidate(collator).is_none()); assert_eq!(StakePallet::unstaking(collator).len(), 1); } assert_eq!(CandidatePool::::count(), 5, "Five collators left."); @@ -906,7 +906,7 @@ fn execute_leave_candidates_with_delay() { collator )); assert!(StakePallet::candidate_pool(&collator).is_none()); - assert!(!StakePallet::is_active_candidate(&collator).is_some()); + assert!(StakePallet::is_active_candidate(&collator).is_none()); assert_eq!(StakePallet::unstaking(collator).len(), 1); } assert_eq!(CandidatePool::::count(), 2, "3 collators left."); diff --git a/rust-toolchain.toml b/rust-toolchain.toml index 810eebdb05..fb3e5de512 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,3 +1,3 @@ [toolchain] -channel = "nightly-2021-11-08" +channel = "nightly-2022-01-08" targets = [ "wasm32-unknown-unknown" ]