Merge pull request #4978 from nymtech/chore/beta-clippy
resolve beta clippy issues in contracts
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
[workspace]
|
||||
resolver = "2"
|
||||
members = [
|
||||
"coconut-bandwidth",
|
||||
# "coconut-bandwidth",
|
||||
"coconut-dkg",
|
||||
"coconut-test",
|
||||
"ecash",
|
||||
|
||||
+3
-3
@@ -1,7 +1,7 @@
|
||||
schema: coconut-bandwidth-schema coconut-dkg-schema mixnet-schema vesting-schema multisig-schema group-schema ecash-schema
|
||||
schema: coconut-dkg-schema mixnet-schema vesting-schema multisig-schema group-schema ecash-schema
|
||||
|
||||
coconut-bandwidth-schema:
|
||||
$(MAKE) -C coconut-bandwidth generate-schema
|
||||
#coconut-bandwidth-schema:
|
||||
# $(MAKE) -C coconut-bandwidth generate-schema
|
||||
|
||||
coconut-dkg-schema:
|
||||
$(MAKE) -C coconut-dkg generate-schema
|
||||
|
||||
@@ -18,7 +18,7 @@ pub(crate) struct SpendCredentialIndex<'a> {
|
||||
|
||||
// IndexList is just boilerplate code for fetching a struct's indexes
|
||||
// note that from my understanding this will be converted into a macro at some point in the future
|
||||
impl<'a> IndexList<SpendCredential> for SpendCredentialIndex<'a> {
|
||||
impl IndexList<SpendCredential> for SpendCredentialIndex<'_> {
|
||||
fn get_indexes(&'_ self) -> Box<dyn Iterator<Item = &'_ dyn Index<SpendCredential>> + '_> {
|
||||
let v: Vec<&dyn Index<SpendCredential>> = vec![&self.blinded_serial_number];
|
||||
Box::new(v.into_iter())
|
||||
|
||||
@@ -57,10 +57,9 @@ pub fn try_advance_epoch_state(deps: DepsMut<'_>, env: Env) -> Result<Response,
|
||||
|
||||
// if we're advancing into dealing exchange, we need to set the threshold value based on the number of registered dealers
|
||||
if next_state.is_dealing_exchange() {
|
||||
// note: ceiling in integer division can be achieved via q = (x + y - 1) / y;
|
||||
let registered_dealers = current_epoch.state_progress.registered_dealers as u64;
|
||||
// set the threshold to 2/3 amount of registered dealers
|
||||
let threshold = (2 * registered_dealers + 3 - 1) / 3;
|
||||
let threshold = (2 * registered_dealers).div_ceil(3);
|
||||
|
||||
// update current threshold values
|
||||
THRESHOLD.save(deps.storage, &threshold)?;
|
||||
|
||||
@@ -16,7 +16,7 @@ pub(crate) struct VkShareIndex<'a> {
|
||||
pub(crate) epoch_id: MultiIndex<'a, EpochId, ContractVKShare, VKShareKey<'a>>,
|
||||
}
|
||||
|
||||
impl<'a> IndexList<ContractVKShare> for VkShareIndex<'a> {
|
||||
impl IndexList<ContractVKShare> for VkShareIndex<'_> {
|
||||
fn get_indexes(&'_ self) -> Box<dyn Iterator<Item = &'_ dyn Index<ContractVKShare>> + '_> {
|
||||
let v: Vec<&dyn Index<ContractVKShare>> = vec![&self.epoch_id];
|
||||
Box::new(v.into_iter())
|
||||
|
||||
@@ -17,7 +17,7 @@ pub(crate) struct DelegationIndex<'a> {
|
||||
pub(crate) mixnode: MultiIndex<'a, NodeId, Delegation, PrimaryKey>,
|
||||
}
|
||||
|
||||
impl<'a> IndexList<Delegation> for DelegationIndex<'a> {
|
||||
impl IndexList<Delegation> for DelegationIndex<'_> {
|
||||
fn get_indexes(&'_ self) -> Box<dyn Iterator<Item = &'_ dyn Index<Delegation>> + '_> {
|
||||
let v: Vec<&dyn Index<Delegation>> = vec![&self.owner, &self.mixnode];
|
||||
Box::new(v.into_iter())
|
||||
|
||||
@@ -18,7 +18,7 @@ pub(crate) struct GatewayBondIndex<'a> {
|
||||
|
||||
// IndexList is just boilerplate code for fetching a struct's indexes
|
||||
// note that from my understanding this will be converted into a macro at some point in the future
|
||||
impl<'a> IndexList<GatewayBond> for GatewayBondIndex<'a> {
|
||||
impl IndexList<GatewayBond> for GatewayBondIndex<'_> {
|
||||
fn get_indexes(&'_ self) -> Box<dyn Iterator<Item = &'_ dyn Index<GatewayBond>> + '_> {
|
||||
let v: Vec<&dyn Index<GatewayBond>> = vec![&self.owner];
|
||||
Box::new(v.into_iter())
|
||||
|
||||
@@ -24,7 +24,7 @@ pub(crate) struct UnbondedMixnodeIndex<'a> {
|
||||
pub(crate) identity_key: MultiIndex<'a, IdentityKey, UnbondedMixnode, NodeId>,
|
||||
}
|
||||
|
||||
impl<'a> IndexList<UnbondedMixnode> for UnbondedMixnodeIndex<'a> {
|
||||
impl IndexList<UnbondedMixnode> for UnbondedMixnodeIndex<'_> {
|
||||
fn get_indexes(&'_ self) -> Box<dyn Iterator<Item = &'_ dyn Index<UnbondedMixnode>> + '_> {
|
||||
let v: Vec<&dyn Index<UnbondedMixnode>> = vec![&self.owner, &self.identity_key];
|
||||
Box::new(v.into_iter())
|
||||
@@ -58,7 +58,7 @@ pub(crate) struct MixnodeBondIndex<'a> {
|
||||
|
||||
// IndexList is just boilerplate code for fetching a struct's indexes
|
||||
// note that from my understanding this will be converted into a macro at some point in the future
|
||||
impl<'a> IndexList<MixNodeBond> for MixnodeBondIndex<'a> {
|
||||
impl IndexList<MixNodeBond> for MixnodeBondIndex<'_> {
|
||||
fn get_indexes(&'_ self) -> Box<dyn Iterator<Item = &'_ dyn Index<MixNodeBond>> + '_> {
|
||||
let v: Vec<&dyn Index<MixNodeBond>> =
|
||||
vec![&self.owner, &self.identity_key, &self.sphinx_key];
|
||||
|
||||
@@ -75,7 +75,7 @@ pub(crate) struct NymNodeBondIndex<'a> {
|
||||
pub(crate) identity_key: UniqueIndex<'a, IdentityKey, NymNodeBond>,
|
||||
}
|
||||
|
||||
impl<'a> IndexList<NymNodeBond> for NymNodeBondIndex<'a> {
|
||||
impl IndexList<NymNodeBond> for NymNodeBondIndex<'_> {
|
||||
fn get_indexes(&'_ self) -> Box<dyn Iterator<Item = &'_ dyn Index<NymNodeBond>> + '_> {
|
||||
let v: Vec<&dyn Index<NymNodeBond>> = vec![&self.owner, &self.identity_key];
|
||||
Box::new(v.into_iter())
|
||||
@@ -103,7 +103,7 @@ pub(crate) struct UnbondedNymNodeIndex<'a> {
|
||||
pub(crate) identity_key: MultiIndex<'a, IdentityKey, UnbondedNymNode, NodeId>,
|
||||
}
|
||||
|
||||
impl<'a> IndexList<UnbondedNymNode> for UnbondedNymNodeIndex<'a> {
|
||||
impl IndexList<UnbondedNymNode> for UnbondedNymNodeIndex<'_> {
|
||||
fn get_indexes(&'_ self) -> Box<dyn Iterator<Item = &'_ dyn Index<UnbondedNymNode>> + '_> {
|
||||
let v: Vec<&dyn Index<UnbondedNymNode>> = vec![&self.owner, &self.identity_key];
|
||||
Box::new(v.into_iter())
|
||||
|
||||
@@ -52,7 +52,7 @@ mod families_purge {
|
||||
pub label: UniqueIndex<'a, FamilyHeadKey, Family>,
|
||||
}
|
||||
|
||||
impl<'a> IndexList<Family> for FamilyIndex<'a> {
|
||||
impl IndexList<Family> for FamilyIndex<'_> {
|
||||
fn get_indexes(&'_ self) -> Box<dyn Iterator<Item = &'_ dyn Index<Family>> + '_> {
|
||||
let v: Vec<&dyn Index<Family>> = vec![&self.label];
|
||||
Box::new(v.into_iter())
|
||||
|
||||
@@ -14,7 +14,6 @@ impl VestingAccount for Account {
|
||||
|
||||
/// See [VestingAccount::locked_coins] for documentation.
|
||||
/// Returns 0 in case of underflow. Which is fine, as the amount of pledged and delegated tokens can be larger then vesting_coins due to rewards and vesting periods expiring
|
||||
|
||||
// TODO: rename. it's no longer 'locked'... or is it?
|
||||
fn locked_coins(
|
||||
&self,
|
||||
|
||||
Reference in New Issue
Block a user