style: Migrate to stable-only rustfmt configuration
- Remove nightly-only features from .rustfmt.toml and vendor/ss58-registry/rustfmt.toml - Removed features: imports_granularity, wrap_comments, comment_width, reorder_impl_items, spaces_around_ranges, binop_separator, match_arm_blocks, trailing_semicolon, trailing_comma - Format all 898 affected files with stable rustfmt - Ensures long-term reliability without nightly toolchain dependency
This commit is contained in:
@@ -708,14 +708,16 @@ pub mod pezpallet {
|
||||
|
||||
let item = (reg_index, Judgement::FeePaid(registrar.fee));
|
||||
match id.judgements.binary_search_by_key(®_index, |x| x.0) {
|
||||
Ok(i) =>
|
||||
Ok(i) => {
|
||||
if id.judgements[i].1.is_sticky() {
|
||||
return Err(Error::<T>::StickyJudgement.into());
|
||||
} else {
|
||||
id.judgements[i] = item
|
||||
},
|
||||
Err(i) =>
|
||||
id.judgements.try_insert(i, item).map_err(|_| Error::<T>::TooManyRegistrars)?,
|
||||
}
|
||||
},
|
||||
Err(i) => {
|
||||
id.judgements.try_insert(i, item).map_err(|_| Error::<T>::TooManyRegistrars)?
|
||||
},
|
||||
}
|
||||
|
||||
T::Currency::reserve(&sender, registrar.fee)?;
|
||||
|
||||
@@ -274,42 +274,50 @@ pub mod v2 {
|
||||
// At first, migrate any authorities.
|
||||
None => Self::authority_step(None),
|
||||
// Migrate any remaining authorities.
|
||||
Some(MigrationState::Authority(maybe_last_authority)) =>
|
||||
Self::authority_step(Some(maybe_last_authority)),
|
||||
Some(MigrationState::Authority(maybe_last_authority)) => {
|
||||
Self::authority_step(Some(maybe_last_authority))
|
||||
},
|
||||
// After the last authority was migrated, start migrating usernames from
|
||||
// the former `AccountOfUsername` into `UsernameInfoOf`.
|
||||
Some(MigrationState::FinishedAuthorities) => Self::username_step(None),
|
||||
// Keep migrating usernames.
|
||||
Some(MigrationState::Username(maybe_last_username)) =>
|
||||
Self::username_step(Some(maybe_last_username)),
|
||||
Some(MigrationState::Username(maybe_last_username)) => {
|
||||
Self::username_step(Some(maybe_last_username))
|
||||
},
|
||||
// After the last username was migrated, start migrating all identities in
|
||||
// `IdentityOf`, which currently hold the primary username of the owner account
|
||||
// as well as any associated identity. Accounts which set a username but not an
|
||||
// identity also have a zero deposit identity stored, which will be removed.
|
||||
Some(MigrationState::FinishedUsernames) => Self::identity_step(None),
|
||||
// Keep migrating identities.
|
||||
Some(MigrationState::Identity(last_key)) =>
|
||||
Self::identity_step(Some(last_key.clone())),
|
||||
Some(MigrationState::Identity(last_key)) => {
|
||||
Self::identity_step(Some(last_key.clone()))
|
||||
},
|
||||
// After the last identity was migrated, start migrating usernames pending
|
||||
// approval from `PendingUsernames`.
|
||||
Some(MigrationState::FinishedIdentities) => Self::pending_username_step(None),
|
||||
// Keep migrating pending usernames.
|
||||
Some(MigrationState::PendingUsername(last_key)) =>
|
||||
Self::pending_username_step(Some(last_key.clone())),
|
||||
Some(MigrationState::PendingUsername(last_key)) => {
|
||||
Self::pending_username_step(Some(last_key.clone()))
|
||||
},
|
||||
// After the last pending username was migrated, start clearing the storage
|
||||
// previously associated with authorities in `UsernameAuthority`.
|
||||
Some(MigrationState::FinishedPendingUsernames) =>
|
||||
Self::cleanup_authority_step(None),
|
||||
Some(MigrationState::FinishedPendingUsernames) => {
|
||||
Self::cleanup_authority_step(None)
|
||||
},
|
||||
// Keep clearing the obsolete authority storage.
|
||||
Some(MigrationState::CleanupAuthorities(maybe_last_username)) =>
|
||||
Self::cleanup_authority_step(Some(maybe_last_username)),
|
||||
Some(MigrationState::CleanupAuthorities(maybe_last_username)) => {
|
||||
Self::cleanup_authority_step(Some(maybe_last_username))
|
||||
},
|
||||
// After the last obsolete authority was cleared from storage, start clearing
|
||||
// the storage previously associated with usernames in `AccountOfUsername`.
|
||||
Some(MigrationState::FinishedCleanupAuthorities) =>
|
||||
Self::cleanup_username_step(None),
|
||||
Some(MigrationState::FinishedCleanupAuthorities) => {
|
||||
Self::cleanup_username_step(None)
|
||||
},
|
||||
// Keep clearing the obsolete username storage.
|
||||
Some(MigrationState::CleanupUsernames(maybe_last_username)) =>
|
||||
Self::cleanup_username_step(Some(maybe_last_username)),
|
||||
Some(MigrationState::CleanupUsernames(maybe_last_username)) => {
|
||||
Self::cleanup_username_step(Some(maybe_last_username))
|
||||
},
|
||||
// After the last obsolete username was cleared from storage, the migration is
|
||||
// done.
|
||||
Some(MigrationState::Finished) => {
|
||||
@@ -428,16 +436,19 @@ pub mod v2 {
|
||||
) -> Weight {
|
||||
match step {
|
||||
MigrationState::Authority(_) => T::WeightInfo::migration_v2_authority_step(),
|
||||
MigrationState::FinishedAuthorities | MigrationState::Username(_) =>
|
||||
T::WeightInfo::migration_v2_username_step(),
|
||||
MigrationState::FinishedUsernames | MigrationState::Identity(_) =>
|
||||
T::WeightInfo::migration_v2_identity_step(),
|
||||
MigrationState::FinishedIdentities | MigrationState::PendingUsername(_) =>
|
||||
T::WeightInfo::migration_v2_pending_username_step(),
|
||||
MigrationState::FinishedPendingUsernames |
|
||||
MigrationState::CleanupAuthorities(_) => T::WeightInfo::migration_v2_cleanup_authority_step(),
|
||||
MigrationState::FinishedCleanupAuthorities |
|
||||
MigrationState::CleanupUsernames(_) => T::WeightInfo::migration_v2_cleanup_username_step(),
|
||||
MigrationState::FinishedAuthorities | MigrationState::Username(_) => {
|
||||
T::WeightInfo::migration_v2_username_step()
|
||||
},
|
||||
MigrationState::FinishedUsernames | MigrationState::Identity(_) => {
|
||||
T::WeightInfo::migration_v2_identity_step()
|
||||
},
|
||||
MigrationState::FinishedIdentities | MigrationState::PendingUsername(_) => {
|
||||
T::WeightInfo::migration_v2_pending_username_step()
|
||||
},
|
||||
MigrationState::FinishedPendingUsernames
|
||||
| MigrationState::CleanupAuthorities(_) => T::WeightInfo::migration_v2_cleanup_authority_step(),
|
||||
MigrationState::FinishedCleanupAuthorities
|
||||
| MigrationState::CleanupUsernames(_) => T::WeightInfo::migration_v2_cleanup_username_step(),
|
||||
MigrationState::Finished => Weight::zero(),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -185,8 +185,8 @@ fn infoof_twenty() -> IdentityInfo<MaxAdditionalFields> {
|
||||
|
||||
fn id_deposit(id: &IdentityInfo<MaxAdditionalFields>) -> u64 {
|
||||
let base_deposit: u64 = <<Test as Config>::BasicDeposit as Get<u64>>::get();
|
||||
let byte_deposit: u64 = <<Test as Config>::ByteDeposit as Get<u64>>::get() *
|
||||
TryInto::<u64>::try_into(id.encoded_size()).unwrap();
|
||||
let byte_deposit: u64 = <<Test as Config>::ByteDeposit as Get<u64>>::get()
|
||||
* TryInto::<u64>::try_into(id.encoded_size()).unwrap();
|
||||
base_deposit + byte_deposit
|
||||
}
|
||||
|
||||
@@ -202,11 +202,11 @@ fn identity_fields_repr_works() {
|
||||
assert_eq!(IdentityField::Image as u64, 1 << 6);
|
||||
assert_eq!(IdentityField::Twitter as u64, 1 << 7);
|
||||
|
||||
let fields = IdentityField::Legal |
|
||||
IdentityField::Web |
|
||||
IdentityField::Riot |
|
||||
IdentityField::PgpFingerprint |
|
||||
IdentityField::Twitter;
|
||||
let fields = IdentityField::Legal
|
||||
| IdentityField::Web
|
||||
| IdentityField::Riot
|
||||
| IdentityField::PgpFingerprint
|
||||
| IdentityField::Twitter;
|
||||
|
||||
assert!(!fields.contains(IdentityField::Display));
|
||||
assert!(fields.contains(IdentityField::Legal));
|
||||
|
||||
@@ -293,8 +293,9 @@ impl<
|
||||
> Registration<Balance, MaxJudgements, IdentityInfo>
|
||||
{
|
||||
pub(crate) fn total_deposit(&self) -> Balance {
|
||||
self.deposit +
|
||||
self.judgements
|
||||
self.deposit
|
||||
+ self
|
||||
.judgements
|
||||
.iter()
|
||||
.map(|(_, ref j)| if let Judgement::FeePaid(fee) = j { *fee } else { Zero::zero() })
|
||||
.fold(Zero::zero(), |a, i| a + i)
|
||||
|
||||
Reference in New Issue
Block a user