Skip to content

Commit

Permalink
Cargo clippy m3 (#191)
Browse files Browse the repository at this point in the history
* change delay
* fixes with cargo-clippy

Co-authored-by: “ilhanu” <[email protected]>
  • Loading branch information
ndkazu and ilhanu authored Oct 26, 2022
1 parent b120576 commit 7a8a6ad
Show file tree
Hide file tree
Showing 8 changed files with 13 additions and 12 deletions.
4 changes: 2 additions & 2 deletions pallets/bidding/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ use frame_support::pallet_prelude::*;
impl<T: Config> Pallet<T> {
fn begin_block(now: T::BlockNumber) -> Weight {
let max_block_weight: u64 = 1000;

#[allow(unused)]
if (now % T::NewAssetScanPeriod::get()).is_zero() {
Self::process_onboarded_assets();
Self::process_finalised_assets();
Expand Down Expand Up @@ -392,7 +392,7 @@ impl<T: Config> Pallet<T> {
// The definitive shares will be determined by this loop
// Each round, 100% is decremented by the share of the contribution processed
for item in eligible_contributions.iter() {
let mut item_share = Self::u64_to_balance_option(0).unwrap();
let item_share;

// We are checking the last item so it takes the remaining percentage
if count == contributions_length {
Expand Down
2 changes: 2 additions & 0 deletions pallets/bidding/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,7 @@ fn create_investor_list_second_case_should_succeed() {
}

#[test]
#[allow(unused_assignments)]
fn create_investor_list_third_case_should_succeed() {
new_test_ext().execute_with(|| {
let mut block_number = System::block_number();
Expand Down Expand Up @@ -303,6 +304,7 @@ fn create_investor_list_third_case_should_succeed() {
}

#[test]
#[allow(unused_assignments)]
fn create_investor_list_fourth_case_should_succeed() {
new_test_ext().execute_with(|| {
let mut block_number = System::block_number();
Expand Down
1 change: 0 additions & 1 deletion pallets/housing_fund/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ pub(crate) type Balance = u128;
type AccountId = u64;
pub type CollectionId = u32;
pub type ItemId = u32;
pub type NftCollection = crate::NFT::PossibleCollections;

// Configure a mock runtime to test the pallet.
frame_support::construct_runtime!(
Expand Down
2 changes: 1 addition & 1 deletion pallets/onboarding/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ fn create_proposal_2() {

let status_bis: AssetStatus = Houses::<Test>::get(coll_id, item_id).unwrap().status;
assert_ne!(status.clone(), status_bis.clone());
println!("status1:{:?}\nstatus2:{:?}", status, status_bis);
println!("status1:{status:?}\nstatus2:{status_bis:?}");

expect_events(vec![
crate::Event::ProposalCreated {
Expand Down
2 changes: 1 addition & 1 deletion pallets/roles/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ mod types;
pub mod weights;
pub use crate::types::*;
pub use pallet_sudo as SUDO;
use sp_std::{fmt::Debug, prelude::*};
use sp_std::{prelude::*};
pub use weights::WeightInfo;
#[frame_support::pallet]
pub mod pallet {
Expand Down
3 changes: 2 additions & 1 deletion pallets/share_distributor/src/functions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
//4) transfer tokens to owners
use super::*;
use enum_iterator::all;
#[allow(unused_imports)]
use num_traits::float::FloatCore;
use sp_runtime::{traits::SaturatedConversion, FixedPointNumber, FixedU128};

Expand All @@ -14,7 +15,7 @@ impl<T: Config> Pallet<T> {
item_id: T::NftItemId,
) -> DispatchResult {
//Create virtual account
let text0 = format!("{:?}_{:?}_account", collection_id, item_id.clone());
let text0 = format!("{collection_id:?}_{:?}_account", item_id.clone());
let bytes = text0.as_bytes();
let array: &[u8; 8] = &bytes[0..8].try_into().unwrap();
let account: T::AccountId = PalletId(*array).into_account_truncating();
Expand Down
6 changes: 3 additions & 3 deletions pallets/share_distributor/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ fn share_distributor0() {
let balance1 = Assets::Pallet::<Test>::balance(id, EVE);

let _infos = ShareDistributor::tokens_infos(new_owner0.clone()).unwrap().owners;
println!("Tokens own by DAVE:{:?}\nTokens own by Eve:{:?}", balance0, balance1);
println!("Tokens own by DAVE:{balance0:?}\nTokens own by Eve:{balance1:?}");
println!("Total supply {:?}", Assets::Pallet::<Test>::total_supply(id));

// Bob creates a second proposal without submiting for review
Expand Down Expand Up @@ -169,7 +169,7 @@ fn share_distributor0() {
let virtual1 = Virtual::<Test>::get(coll_id1, item_id1).unwrap();

//Check that virtual accounts are different
println!("Virtual account nbr1:{:?}\nVirtual account nbr2:{:?}", virtual0, virtual1);
println!("Virtual account nbr1:{virtual0:?}\nVirtual account nbr2:{virtual1:?}");
assert_ne!(virtual0.virtual_account, virtual1.virtual_account);
//Check that virtual accounts are the new owners
assert_eq!(new_owner0, virtual0.virtual_account);
Expand Down Expand Up @@ -274,7 +274,7 @@ fn share_distributor1() {
);
let infos = ShareDistributor::tokens_infos(new_owner0.clone()).unwrap().owners;

println!("Again, new owners are:\n{:?}", infos);
println!("Again, new owners are:\n{infos:?}");

assert_eq!(owners.len() > 1, true);
expect_events(vec![
Expand Down
5 changes: 2 additions & 3 deletions runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -980,10 +980,9 @@ impl Contains<Call> for DontAllowCollectiveAndDemocracy {
}
}
}

parameter_types! {
pub const Delay: BlockNumber = 0 * MINUTES;//3 * MINUTES;
pub const CheckDelay: BlockNumber = MINUTES;//3 * MINUTES;
pub const Delay: BlockNumber = MINUTES;// No-delay;
pub const CheckDelay: BlockNumber = MINUTES;//No-delay;
pub const InvestorVoteAmount: u128 = 10 * DOLLARS;
pub const CheckPeriod: BlockNumber = MINUTES;
}
Expand Down

0 comments on commit 7a8a6ad

Please sign in to comment.