Skip to content

Commit

Permalink
fix: lint
Browse files Browse the repository at this point in the history
  • Loading branch information
pandres95 committed Nov 19, 2023
1 parent 9bd25c2 commit 1836eac
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
10 changes: 5 additions & 5 deletions pallets/communities/src/functions/validation/challenges.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,17 @@ impl<T: Config> ValidationChallenge for Pallet<T> {
registrar_id: Self::ChallengeRegistrarId,
community_id: Self::EntityId,
) -> Result<(), ChallengeRegistrationRejectionCause> {
let info = Self::community(&community_id).ok_or(ChallengeRegistrationRejectionCause::EntityDoesNotExist)?;
let info = Self::community(community_id).ok_or(ChallengeRegistrationRejectionCause::EntityDoesNotExist)?;

if info.state == CommunityState::Suspended {
Err(ChallengeRegistrationRejectionCause::EntityBlocked)?;
}

if Challenges::<T>::contains_key(&community_id, &registrar_id) {
if Challenges::<T>::contains_key(community_id, &registrar_id) {
Err(ChallengeRegistrationRejectionCause::ChallengeAlreadyActiveForEntity)?;
}

Challenges::<T>::insert(&community_id, &registrar_id, ());
Challenges::<T>::insert(community_id, &registrar_id, ());

Ok(())
}
Expand All @@ -35,10 +35,10 @@ impl<T: Config> ValidationChallenge for Pallet<T> {
passed: bool,
_reason: Option<Vec<u8>>,
) -> Result<(), ValidationRejectionCause> {
Info::<T>::try_mutate(&community_id, |info| {
Info::<T>::try_mutate(community_id, |info| {
let info = info.as_mut().ok_or(ValidationRejectionCause::EntityDoesNotExist)?;

Challenges::<T>::try_mutate_exists(&community_id, registrar_id, |challenge| {
Challenges::<T>::try_mutate_exists(community_id, registrar_id, |challenge| {
if challenge.as_mut().is_none() {
Err(ValidationRejectionCause::ChallengeForRegistrarNotFound)?;
}
Expand Down
2 changes: 1 addition & 1 deletion pallets/communities/src/tests/mock/challenger.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ impl<T: Config> From<Error<T>> for DispatchError {
Error::FailedValidation(_) => 1u32.to_le_bytes(),
_ => u32::MAX.to_le_bytes(),
},
message: Some(&match error {
message: Some(match error {
Error::FailedRegistering(_) => "FailedRegistering",
Error::FailedValidation(_) => "FailedValidation",
_ => unimplemented!(),
Expand Down
4 changes: 2 additions & 2 deletions pallets/communities/src/tests/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,6 @@ fn setup() {
}

fn activate_community(entity_id: CommunityId) {
assert_ok!(Challenger::<Test>::register(entity_id.clone()));
assert_ok!(Challenger::<Test>::validate(entity_id.clone(), true));
assert_ok!(Challenger::<Test>::register(entity_id));
assert_ok!(Challenger::<Test>::validate(entity_id, true));
}

0 comments on commit 1836eac

Please sign in to comment.