diff --git a/pallets/conviction-voting/src/tests.rs b/pallets/conviction-voting/src/tests.rs index d18bda853..503603087 100644 --- a/pallets/conviction-voting/src/tests.rs +++ b/pallets/conviction-voting/src/tests.rs @@ -1030,10 +1030,10 @@ fn errors_with_remove_vote_work() { }); } thread_local! { - static LAST_ON_VOTE_DATA: RefCell)>> = RefCell::new(None); - static LAST_ON_REMOVE_VOTE_DATA: RefCell)>> = RefCell::new(None); - static LAST_LOCKED_IF_UNSUCCESSFUL_VOTE_DATA: RefCell> = RefCell::new(None); - static REMOVE_VOTE_LOCKED_AMOUNT: RefCell> = RefCell::new(None); + static LAST_ON_VOTE_DATA: RefCell)>> = const { RefCell::new(None) }; + static LAST_ON_REMOVE_VOTE_DATA: RefCell)>> = const { RefCell::new(None) }; + static LAST_LOCKED_IF_UNSUCCESSFUL_VOTE_DATA: RefCell> = const { RefCell::new(None) }; + static REMOVE_VOTE_LOCKED_AMOUNT: RefCell> = const { RefCell::new(None) }; } pub struct HooksHandler; diff --git a/pallets/staking/src/integrations/conviction_voting.rs b/pallets/staking/src/integrations/conviction_voting.rs index d3a2e2ce0..f34de384b 100644 --- a/pallets/staking/src/integrations/conviction_voting.rs +++ b/pallets/staking/src/integrations/conviction_voting.rs @@ -129,9 +129,7 @@ where } fn locked_if_unsuccessful_vote(who: &T::AccountId, ref_index: ReferendumIndex) -> Option { - let Some(position_id) = Pallet::::get_user_position_id(who).ok()? else { - return None; - }; + let position_id = Pallet::::get_user_position_id(who).ok()??; if let Some(vote) = ProcessedVotes::::get(who, ref_index) { return Some(vote.amount);