* Add clippy config and remove .cargo from gitignore

* first fixes

* Clippyfied

* Add clippy CI job

* comment out rusty-cachier

* minor

* fix ci

* remove DAG from check-dependent-project

* add DAG to clippy

Co-authored-by: alvicsam <alvicsam@gmail.com>
This commit is contained in:
alexgparity
2022-11-30 09:34:06 +01:00
committed by GitHub
parent b76086c617
commit 9ea14e66c8
67 changed files with 338 additions and 351 deletions
+10 -14
View File
@@ -247,12 +247,9 @@ pub mod pallet {
impl<T: Config> GenesisBuild<T> for GenesisConfig<T> {
fn build(&self) {
// build `Claims`
self.claims
.iter()
.map(|(a, b, _, _)| (a.clone(), b.clone()))
.for_each(|(a, b)| {
Claims::<T>::insert(a, b);
});
self.claims.iter().map(|(a, b, _, _)| (*a, *b)).for_each(|(a, b)| {
Claims::<T>::insert(a, b);
});
// build `Total`
Total::<T>::put(
self.claims
@@ -266,17 +263,16 @@ pub mod pallet {
// build `Signing`
self.claims
.iter()
.filter_map(|(a, _, _, s)| Some((a.clone(), s.clone()?)))
.filter_map(|(a, _, _, s)| Some((*a, (*s)?)))
.for_each(|(a, s)| {
Signing::<T>::insert(a, s);
});
// build `Preclaims`
self.claims
.iter()
.filter_map(|(a, _, i, _)| Some((i.clone()?, a.clone())))
.for_each(|(i, a)| {
self.claims.iter().filter_map(|(a, _, i, _)| Some((i.clone()?, *a))).for_each(
|(i, a)| {
Preclaims::<T>::insert(i, a);
});
},
);
}
}
@@ -538,7 +534,7 @@ impl<T: Config> Pallet<T> {
}
let mut v = b"\x19Ethereum Signed Message:\n".to_vec();
v.extend(rev.into_iter().rev());
v.extend_from_slice(&prefix[..]);
v.extend_from_slice(prefix);
v.extend_from_slice(what);
v.extend_from_slice(extra);
v
@@ -645,7 +641,7 @@ where
info: &DispatchInfoOf<Self::Call>,
len: usize,
) -> Result<Self::Pre, TransactionValidityError> {
Ok(self.validate(who, call, info, len).map(|_| ())?)
self.validate(who, call, info, len).map(|_| ())
}
// <weight>
@@ -67,12 +67,10 @@ pub mod crowdloan_index_migration {
let leases = Leases::<T>::get(para_id).unwrap_or_default();
let mut found_lease_deposit = false;
for maybe_deposit in leases.iter() {
if let Some((who, _amount)) = maybe_deposit {
if *who == old_fund_account {
found_lease_deposit = true;
break
}
for (who, _amount) in leases.iter().flatten() {
if *who == old_fund_account {
found_lease_deposit = true;
break
}
}
if found_lease_deposit {
@@ -112,11 +110,9 @@ pub mod crowdloan_index_migration {
weight = weight.saturating_add(T::DbWeight::get().reads_writes(1, 2));
let mut leases = Leases::<T>::get(para_id).unwrap_or_default();
for maybe_deposit in leases.iter_mut() {
if let Some((who, _amount)) = maybe_deposit {
if *who == old_fund_account {
*who = new_fund_account.clone();
}
for (who, _amount) in leases.iter_mut().flatten() {
if *who == old_fund_account {
*who = new_fund_account.clone();
}
}
@@ -162,13 +158,11 @@ pub mod crowdloan_index_migration {
let leases = Leases::<T>::get(para_id).unwrap_or_default();
let mut new_account_found = false;
for maybe_deposit in leases.iter() {
if let Some((who, _amount)) = maybe_deposit {
if *who == old_fund_account {
panic!("Old fund account found after migration!");
} else if *who == new_fund_account {
new_account_found = true;
}
for (who, _amount) in leases.iter().flatten() {
if *who == old_fund_account {
panic!("Old fund account found after migration!");
} else if *who == new_fund_account {
new_account_found = true;
}
}
if new_account_found {
+16 -22
View File
@@ -31,18 +31,16 @@ pub mod slots_crowdloan_index_migration {
for (para_id, leases) in Leases::<T>::iter() {
let old_fund_account = old_fund_account_id::<T>(para_id);
for maybe_deposit in leases.iter() {
if let Some((who, _amount)) = maybe_deposit {
if *who == old_fund_account {
let crowdloan =
crowdloan::Funds::<T>::get(para_id).ok_or("no crowdloan found")?;
log::info!(
target: "runtime",
"para_id={:?}, old_fund_account={:?}, fund_id={:?}, leases={:?}",
para_id, old_fund_account, crowdloan.fund_index, leases,
);
break
}
for (who, _amount) in leases.iter().flatten() {
if *who == old_fund_account {
let crowdloan =
crowdloan::Funds::<T>::get(para_id).ok_or("no crowdloan found")?;
log::info!(
target: "runtime",
"para_id={:?}, old_fund_account={:?}, fund_id={:?}, leases={:?}",
para_id, old_fund_account, crowdloan.fund_index, leases,
);
break
}
}
}
@@ -61,11 +59,9 @@ pub mod slots_crowdloan_index_migration {
let new_fund_account = crowdloan::Pallet::<T>::fund_account_id(fund.fund_index);
// look for places the old account is used, and replace with the new account.
for maybe_deposit in leases.iter_mut() {
if let Some((who, _amount)) = maybe_deposit {
if *who == old_fund_account {
*who = new_fund_account.clone();
}
for (who, _amount) in leases.iter_mut().flatten() {
if *who == old_fund_account {
*who = new_fund_account.clone();
}
}
@@ -83,11 +79,9 @@ pub mod slots_crowdloan_index_migration {
let old_fund_account = old_fund_account_id::<T>(para_id);
log::info!(target: "runtime", "checking para_id: {:?}", para_id);
// check the old fund account doesn't exist anywhere.
for maybe_deposit in leases.iter() {
if let Some((who, _amount)) = maybe_deposit {
if *who == old_fund_account {
panic!("old fund account found after migration!");
}
for (who, _amount) in leases.iter().flatten() {
if *who == old_fund_account {
panic!("old fund account found after migration!");
}
}
}