Migrate srml crates to the 2018 edition (#1755)

This commit is contained in:
Stanislav Tkach
2019-02-11 12:42:36 +02:00
committed by Gav Wood
parent b28f7328ac
commit c860787db7
37 changed files with 220 additions and 422 deletions
+2 -20
View File
@@ -18,36 +18,18 @@
#![cfg_attr(not(feature = "std"), no_std)]
#[cfg(feature = "std")]
extern crate serde;
#[cfg(test)]
#[macro_use]
extern crate hex_literal;
#[cfg(test)]
extern crate srml_balances as balances;
extern crate parity_codec as codec;
extern crate parity_codec_derive;
extern crate substrate_primitives;
extern crate sr_std as rstd;
extern crate sr_io as runtime_io;
#[macro_use] extern crate srml_support;
extern crate sr_primitives as primitives;
extern crate srml_democracy as democracy;
extern crate srml_system as system;
pub mod voting;
pub mod motions;
pub mod seats;
pub use seats::{Trait, Module, RawEvent, Event, VoteIndex};
pub use crate::seats::{Trait, Module, RawEvent, Event, VoteIndex};
#[cfg(test)]
mod tests {
// These re-exports are here for a reason, edit with care
pub use super::*;
pub use runtime_io::with_externalities;
use srml_support::{impl_outer_origin, impl_outer_event, impl_outer_dispatch};
pub use substrate_primitives::H256;
pub use primitives::BuildStorage;
pub use primitives::traits::{BlakeTwo256, IdentityLookup};
+5 -4
View File
@@ -21,7 +21,7 @@ use rstd::result;
use substrate_primitives::u32_trait::Value as U32;
use primitives::traits::{Hash, EnsureOrigin};
use srml_support::dispatch::{Dispatchable, Parameter};
use srml_support::{StorageValue, StorageMap};
use srml_support::{StorageValue, StorageMap, decl_module, decl_event, decl_storage, ensure};
use super::{Trait as CouncilTrait, Module as Council};
use system::{self, ensure_signed};
@@ -202,10 +202,11 @@ impl<O, N: U32> EnsureOrigin<O> for EnsureMembers<N>
mod tests {
use super::*;
use super::RawEvent;
use ::tests::*;
use ::tests::{Call, Origin, Event as OuterEvent};
use srml_support::Hashable;
use crate::tests::*;
use crate::tests::{Call, Origin, Event as OuterEvent};
use srml_support::{Hashable, assert_ok, assert_noop};
use system::{EventRecord, Phase};
use hex_literal::{hex, hex_impl};
#[test]
fn motions_basic_environment_works() {
+5 -2
View File
@@ -19,7 +19,7 @@
use rstd::prelude::*;
use primitives::traits::{Zero, One, As, StaticLookup};
use runtime_io::print;
use srml_support::{StorageValue, StorageMap, dispatch::Result, traits::Currency};
use srml_support::{StorageValue, StorageMap, dispatch::Result, traits::Currency, decl_storage, decl_event, ensure};
use democracy;
use system::{self, ensure_signed};
@@ -77,6 +77,8 @@ use system::{self, ensure_signed};
// after each vote as all but K entries are cleared. newly registering candidates must use cleared
// entries before they increase the capacity.
use srml_support::decl_module;
pub type VoteIndex = u32;
type BalanceOf<T> = <<T as democracy::Trait>::Currency as Currency<<T as system::Trait>::AccountId>>::Balance;
@@ -547,7 +549,8 @@ impl<T: Trait> Module<T> {
#[cfg(test)]
mod tests {
use super::*;
use ::tests::*;
use crate::tests::*;
use srml_support::{assert_ok, assert_noop, assert_err};
#[test]
fn params_should_work() {
+4 -4
View File
@@ -21,7 +21,7 @@ use rstd::borrow::Borrow;
use primitives::traits::{Hash, As, Zero};
use runtime_io::print;
use srml_support::dispatch::Result;
use srml_support::{StorageValue, StorageMap, IsSubType};
use srml_support::{StorageValue, StorageMap, IsSubType, decl_module, decl_storage, decl_event, ensure};
use {system, democracy};
use super::{Trait as CouncilTrait, Module as Council};
use system::ensure_signed;
@@ -232,9 +232,9 @@ impl<T: Trait> Module<T> {
#[cfg(test)]
mod tests {
use super::*;
use ::tests::*;
use ::tests::{Call, Origin};
use srml_support::Hashable;
use crate::tests::*;
use crate::tests::{Call, Origin};
use srml_support::{Hashable, assert_ok, assert_noop};
use democracy::{ReferendumInfo, VoteThreshold};
#[test]