Migrate srml-support to the 2018 edition (#1663)

This commit is contained in:
Stanislav Tkach
2019-02-03 12:42:12 +02:00
committed by Gav Wood
parent ddb44db551
commit 87f0f6fd8f
10 changed files with 48 additions and 63 deletions
@@ -46,12 +46,12 @@
//!# fn main() { }
//! ```
use codec;
use rstd::vec::Vec;
use crate::codec;
use crate::rstd::vec::Vec;
#[doc(hidden)]
pub use rstd::borrow::Borrow;
pub use crate::rstd::borrow::Borrow;
#[doc(hidden)]
pub use rstd::marker::PhantomData;
pub use crate::rstd::marker::PhantomData;
pub use srml_metadata::{
DecodeDifferent, StorageMetadata, StorageFunctionMetadata,
@@ -525,7 +525,7 @@ mod tests {
use std::cell::RefCell;
use codec::Codec;
use super::*;
use rstd::marker::PhantomData;
use crate::rstd::marker::PhantomData;
impl Storage for RefCell<HashMap<Vec<u8>, Vec<u8>>> {
fn exists(&self, key: &[u8]) -> bool {
@@ -600,7 +600,7 @@ mod tests {
pub struct Module<T: Trait> for enum Call where origin: T::Origin {}
}
decl_storage! {
crate::decl_storage! {
trait Store for Module<T: Trait> as TestStorage {
// non-getters: pub / $default
@@ -923,7 +923,7 @@ mod test2 {
type PairOf<T> = (T, T);
decl_storage! {
crate::decl_storage! {
trait Store for Module<T: Trait> as TestStorage {
SingleDef : u32;
PairDef : PairOf<u32>;
@@ -955,7 +955,7 @@ mod test3 {
decl_module! {
pub struct Module<T: Trait> for enum Call where origin: T::Origin {}
}
decl_storage! {
crate::decl_storage! {
trait Store for Module<T: Trait> as Test {
Foo get(foo) config(initial_foo): u32;
}
+6 -6
View File
@@ -16,10 +16,10 @@
//! Stuff to do with the runtime's storage.
use rstd::prelude::*;
use rstd::borrow::Borrow;
use crate::rstd::prelude::*;
use crate::rstd::borrow::Borrow;
use runtime_io::{self, twox_128};
use codec::{Codec, Decode, KeyedVec, Input};
use crate::codec::{Codec, Decode, KeyedVec, Input};
#[macro_use]
pub mod generator;
@@ -32,7 +32,7 @@ struct IncrementalInput<'a> {
impl<'a> Input for IncrementalInput<'a> {
fn read(&mut self, into: &mut [u8]) -> usize {
let len = runtime_io::read_storage(self.key, into, self.pos).unwrap_or(0);
let read = ::rstd::cmp::min(len, into.len());
let read = crate::rstd::cmp::min(len, into.len());
self.pos += read;
read
}
@@ -123,7 +123,7 @@ pub fn put_raw(key: &[u8], value: &[u8]) {
/// The underlying runtime storage.
pub struct RuntimeStorage;
impl ::GenericStorage for RuntimeStorage {
impl crate::GenericStorage for RuntimeStorage {
fn exists(&self, key: &[u8]) -> bool {
super::storage::exists(key)
}
@@ -396,7 +396,7 @@ pub trait StorageVec {
}
pub mod unhashed {
use rstd::borrow::Borrow;
use crate::rstd::borrow::Borrow;
use super::{runtime_io, Codec, Decode, KeyedVec, Vec, IncrementalInput};
/// Return the value of the item in storage under `key`, or `None` if there is no explicit entry.