Skip to content

Commit

Permalink
Migrate everything to the 2018 edition (paritytech#1758)
Browse files Browse the repository at this point in the history
  • Loading branch information
stanislav-tkach authored and gavofyork committed Feb 13, 2019
1 parent 71fb444 commit ac9d30a
Show file tree
Hide file tree
Showing 38 changed files with 75 additions and 116 deletions.
1 change: 0 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,11 @@ name = "substrate"
version = "0.10.0"
authors = ["Parity Technologies <admin@parity.io>"]
build = "build.rs"
edition = "2018"

[dependencies]
error-chain = "0.12"
node-cli = { path = "node/cli" }
cli = { package = "node-cli", path = "node/cli" }
futures = "0.1"
ctrlc = { version = "3.0", features = ["termination"] }

Expand Down
2 changes: 0 additions & 2 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@
// You should have received a copy of the GNU General Public License
// along with Substrate. If not, see <http://www.gnu.org/licenses/>.

extern crate vergen;

use vergen::{ConstantsFlags, generate_cargo_keys};

const ERROR_MSG: &'static str = "Failed to generate metadata files";
Expand Down
1 change: 0 additions & 1 deletion core/client/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ trie = { package = "substrate-trie", path = "../trie", optional = true }
substrate-telemetry = { path = "../telemetry", optional = true }
hash-db = { version = "0.11", optional = true }
kvdb = { git = "https://github.com/paritytech/parity-common", optional = true, rev="b0317f649ab2c665b7987b8475878fc4d2e1f81d" }

parity-codec = { version = "3.0", default-features = false }
parity-codec-derive = { version = "3.0", default-features = false }
primitives = { package = "substrate-primitives", path = "../primitives", default-features = false }
Expand Down
2 changes: 1 addition & 1 deletion core/client/src/block_builder/block_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

use super::api::BlockBuilder as BlockBuilderApi;
use std::vec::Vec;
use codec::Encode;
use parity_codec::Encode;
use crate::blockchain::HeaderBackend;
use runtime_primitives::traits::{
Header as HeaderT, Hash, Block as BlockT, One, HashFor, ProvideRuntimeApi, ApiRef
Expand Down
2 changes: 1 addition & 1 deletion core/client/src/call_executor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
// along with Substrate. If not, see <http://www.gnu.org/licenses/>.

use std::{sync::Arc, cmp::Ord, panic::UnwindSafe, result};
use codec::{Encode, Decode};
use parity_codec::{Encode, Decode};
use runtime_primitives::generic::BlockId;
use runtime_primitives::traits::Block as BlockT;
use state_machine::{
Expand Down
2 changes: 1 addition & 1 deletion core/client/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ use crate::runtime_api::{CallRuntimeAt, ConstructRuntimeApi};
use primitives::{Blake2Hasher, H256, ChangesTrieConfiguration, convert_hash, NeverNativeValue};
use primitives::storage::{StorageKey, StorageData};
use primitives::storage::well_known_keys;
use codec::{Encode, Decode};
use parity_codec::{Encode, Decode};
use state_machine::{
DBValue, Backend as StateBackend, CodeExecutor, ChangesTrieAnchorBlockId,
ExecutionStrategy, ExecutionManager, prove_read,
Expand Down
2 changes: 1 addition & 1 deletion core/client/src/genesis.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ pub fn construct_genesis_block<
#[cfg(test)]
mod tests {
use super::*;
use codec::{Encode, Decode, Joiner};
use parity_codec::{Encode, Decode, Joiner};
use keyring::Keyring;
use executor::{NativeExecutionDispatch, native_executor_instance};
use state_machine::{execute, OverlayedChanges, ExecutionStrategy, InMemoryChangesTrieStorage};
Expand Down
2 changes: 1 addition & 1 deletion core/client/src/leaves.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ use std::collections::BTreeSet;
use std::cmp::{Ord, Ordering};
use kvdb::{KeyValueDB, DBTransaction};
use runtime_primitives::traits::SimpleArithmetic;
use codec::{Encode, Decode};
use parity_codec::{Encode, Decode};
use crate::error;

/// helper wrapper type to keep a list of block hashes ordered
Expand Down
2 changes: 0 additions & 2 deletions core/client/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@
#![warn(missing_docs)]
#![recursion_limit="128"]

extern crate parity_codec as codec;

#[macro_use]
pub mod runtime_api;
#[cfg(feature = "std")]
Expand Down
2 changes: 1 addition & 1 deletion core/client/src/light/call_executor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
use std::{collections::HashSet, sync::Arc, panic::UnwindSafe, result, marker::PhantomData};
use futures::{IntoFuture, Future};

use codec::{Encode, Decode};
use parity_codec::{Encode, Decode};
use primitives::{H256, Blake2Hasher, convert_hash, NativeOrEncoded};
use runtime_primitives::generic::BlockId;
use runtime_primitives::traits::{As, Block as BlockT, Header as HeaderT};
Expand Down
2 changes: 1 addition & 1 deletion core/client/src/runtime_api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ pub use runtime_version::{ApiId, RuntimeVersion, ApisVec, create_apis_vec};
pub use rstd::{slice, mem};
#[cfg(feature = "std")]
use rstd::result;
pub use codec::{Encode, Decode};
pub use parity_codec::{Encode, Decode};
#[cfg(feature = "std")]
use crate::error;
use rstd::vec::Vec;
Expand Down
2 changes: 1 addition & 1 deletion core/consensus/aura/slots/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ description = "Generic slots-based utilities for consensus"
edition = "2018"

[dependencies]
parity-codec = "3.0"
codec = { package = "parity-codec", version = "3.0" }
client = { package = "substrate-client", path = "../../../client" }
primitives = { package = "substrate-primitives", path = "../../../primitives" }
runtime_primitives = { package = "sr-primitives", path = "../../../sr-primitives" }
Expand Down
4 changes: 1 addition & 3 deletions core/consensus/aura/slots/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@
// You should have received a copy of the GNU General Public License
// along with Substrate. If not, see <http://www.gnu.org/licenses/>.

extern crate parity_codec as codec;

mod slots;

pub use slots::{Slots, SlotInfo};
Expand Down Expand Up @@ -220,7 +218,7 @@ impl SlotDuration {
C: ProvideRuntimeApi,
C::Api: AuraApi<B>,
{
use parity_codec::Decode;
use codec::Decode;
const SLOT_KEY: &[u8] = b"aura_slot_duration";

match client.get_aux(SLOT_KEY)? {
Expand Down
5 changes: 2 additions & 3 deletions core/consensus/rhd/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ edition = "2018"

[dependencies]
futures = "0.1.17"
parity-codec = { version = "3.0" }
codec = { package = "parity-codec", version = "3.0" }
parity-codec-derive = { version = "3.0" }
primitives = { package = "substrate-primitives", path = "../../primitives" }
consensus = { package = "substrate-consensus-common", path = "../common" }
Expand All @@ -27,8 +27,7 @@ rhododendron = { version = "0.5.0", features = ["codec"] }
exit-future = "0.1"

[dev-dependencies]
substrate-keyring = { path = "../../keyring" }
substrate-executor = { path = "../../executor" }
keyring = { package = "substrate-keyring", path = "../../keyring" }

[features]
default = ["std"]
Expand Down
2 changes: 0 additions & 2 deletions core/consensus/rhd/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1318,8 +1318,6 @@ mod tests {
use primitives::H256;
use self::keyring::Keyring;

extern crate substrate_keyring as keyring;

type TestBlock = GenericTestBlock<()>;

struct FakeClient {
Expand Down
2 changes: 1 addition & 1 deletion core/network-libp2p/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
[package]
description = "libp2p implementation of the ethcore network library"
edition = "2018"
homepage = "http://parity.io"
license = "GPL-3.0"
name = "substrate-network-libp2p"
version = "0.1.0"
authors = ["Parity Technologies <admin@parity.io>"]
edition = "2018"

[dependencies]
bytes = "0.4"
Expand Down
9 changes: 5 additions & 4 deletions core/sr-api-macros/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
name = "sr-api-macros"
version = "0.1.0"
authors = ["Parity Technologies <admin@parity.io>"]
edition = "2018"

[lib]
proc-macro = true
Expand All @@ -14,10 +15,10 @@ blake2-rfc = "0.2"
proc-macro-crate = "0.1.3"

[dev-dependencies]
substrate-client = { path = "../client" }
substrate-test-client = { path = "../test-client" }
substrate-state-machine = { path = "../state-machine" }
sr-primitives = { path = "../sr-primitives" }
client = { package = "substrate-client", path = "../client" }
test_client = { package = "substrate-test-client", path = "../test-client" }
state_machine = { package = "substrate-state-machine", path = "../state-machine" }
runtime_primitives = { package = "sr-primitives", path = "../sr-primitives" }
sr-version = { path = "../sr-version" }
substrate-primitives = { path = "../primitives" }
criterion = "0.2"
Expand Down
6 changes: 0 additions & 6 deletions core/sr-api-macros/benches/bench.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,6 @@
// You should have received a copy of the GNU General Public License
// along with Substrate. If not, see <http://www.gnu.org/licenses/>.

#[macro_use]
extern crate criterion;
extern crate substrate_client;
extern crate substrate_test_client as test_client;
extern crate sr_primitives as runtime_primitives;

use criterion::Criterion;
use test_client::runtime::TestAPI;
use runtime_primitives::{generic::BlockId, traits::ProvideRuntimeApi};
Expand Down
28 changes: 14 additions & 14 deletions core/sr-api-macros/src/compile_fail_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ mod declaring_own_block {
/*!
```compile_fail
#[macro_use]
extern crate substrate_client;
extern crate client;
extern crate sr_primitives as runtime_primitives;
use runtime_primitives::traits::Block as BlockT;
Expand All @@ -40,7 +40,7 @@ mod declaring_own_block_with_different_name {
/*!
```compile_fail
#[macro_use]
extern crate substrate_client;
extern crate client;
extern crate sr_primitives as runtime_primitives;
use runtime_primitives::traits::Block as BlockT;
Expand All @@ -60,7 +60,7 @@ mod adding_self_parameter {
/*!
```compile_fail
#[macro_use]
extern crate substrate_client;
extern crate client;
extern crate sr_primitives as runtime_primitives;
decl_runtime_apis! {
Expand All @@ -78,7 +78,7 @@ mod adding_at_parameter {
/*!
```compile_fail
#[macro_use]
extern crate substrate_client;
extern crate client;
extern crate sr_primitives as runtime_primitives;
decl_runtime_apis! {
Expand All @@ -96,7 +96,7 @@ mod invalid_api_version {
/*!
```compile_fail
#[macro_use]
extern crate substrate_client;
extern crate client;
extern crate sr_primitives as runtime_primitives;
decl_runtime_apis! {
Expand All @@ -115,7 +115,7 @@ mod invalid_api_version_2 {
/*!
```compile_fail
#[macro_use]
extern crate substrate_client;
extern crate client;
extern crate sr_primitives as runtime_primitives;
decl_runtime_apis! {
Expand All @@ -134,7 +134,7 @@ mod invalid_api_version_3 {
/*!
```compile_fail
#[macro_use]
extern crate substrate_client;
extern crate client;
extern crate sr_primitives as runtime_primitives;
decl_runtime_apis! {
Expand All @@ -153,7 +153,7 @@ mod missing_block_generic_parameter {
/*!
```compile_fail
#[macro_use]
extern crate substrate_client;
extern crate client;
extern crate substrate_test_client as test_client;
extern crate sr_primitives as runtime_primitives;
extern crate substrate_primitives as primitives;
Expand Down Expand Up @@ -191,7 +191,7 @@ mod missing_path_for_trait {
/*!
```compile_fail
#[macro_use]
extern crate substrate_client;
extern crate client;
extern crate substrate_test_client as test_client;
extern crate sr_primitives as runtime_primitives;
extern crate substrate_primitives as primitives;
Expand Down Expand Up @@ -229,7 +229,7 @@ mod empty_impl_runtime_apis_call {
/*!
```compile_fail
#[macro_use]
extern crate substrate_client;
extern crate client;
extern crate substrate_test_client as test_client;
extern crate sr_primitives as runtime_primitives;
extern crate substrate_primitives as primitives;
Expand Down Expand Up @@ -261,7 +261,7 @@ mod type_reference_in_impl_runtime_apis_call {
/*!
```compile_fail
#[macro_use]
extern crate substrate_client;
extern crate client;
extern crate substrate_test_client as test_client;
extern crate sr_primitives as runtime_primitives;
extern crate substrate_primitives as primitives;
Expand Down Expand Up @@ -299,7 +299,7 @@ mod impl_incorrect_method_signature {
/*!
```compile_fail
#[macro_use]
extern crate substrate_client;
extern crate client;
extern crate substrate_test_client as test_client;
extern crate sr_primitives as runtime_primitives;
extern crate substrate_primitives as primitives;
Expand Down Expand Up @@ -335,7 +335,7 @@ mod impl_two_traits_with_same_name {
/*!
```compile_fail
#[macro_use]
extern crate substrate_client;
extern crate client;
extern crate substrate_test_client as test_client;
extern crate sr_primitives as runtime_primitives;
extern crate substrate_primitives as primitives;
Expand Down Expand Up @@ -383,7 +383,7 @@ mod changed_at_unknown_version {
/*!
```compile_fail
#[macro_use]
extern crate substrate_client;
extern crate client;
extern crate substrate_test_client as test_client;
extern crate sr_primitives as runtime_primitives;
extern crate substrate_primitives as primitives;
Expand Down
6 changes: 3 additions & 3 deletions core/sr-api-macros/src/decl_runtime_apis.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
// You should have received a copy of the GNU General Public License
// along with Substrate. If not, see <http://www.gnu.org/licenses/>.

use utils::{
use crate::utils::{
generate_crate_access, generate_hidden_includes, generate_runtime_mod_name_for_trait,
fold_fn_decl_for_client_side, unwrap_or_error, extract_parameter_names_types_and_borrows,
generate_native_call_generator_fn_name, return_type_extract_type,
Expand Down Expand Up @@ -241,7 +241,7 @@ fn generate_native_call_generators(decl: &ItemTrait) -> Result<TokenStream> {

let (impl_generics, ty_generics, where_clause) = decl.generics.split_for_impl();
// We need to parse them again, to get an easy access to the actual parameters.
let mut impl_generics: Generics = parse_quote!(#impl_generics);
let impl_generics: Generics = parse_quote!(#impl_generics);
let impl_generics_params = impl_generics.params.iter().map(|p| {
match p {
GenericParam::Type(ref ty) => {
Expand Down Expand Up @@ -614,7 +614,7 @@ fn generate_client_side_decls(decls: &[ItemTrait]) -> TokenStream {
let mut result = Vec::new();

for decl in decls {
let mut decl = decl.clone();
let decl = decl.clone();

let crate_ = generate_crate_access(HIDDEN_INCLUDES_ID);
let block_id = quote!( #crate_::runtime_api::BlockId<Block> );
Expand Down
2 changes: 1 addition & 1 deletion core/sr-api-macros/src/impl_runtime_apis.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
// You should have received a copy of the GNU General Public License
// along with Substrate. If not, see <http://www.gnu.org/licenses/>.

use utils::{
use crate::utils::{
unwrap_or_error, generate_crate_access, generate_hidden_includes,
generate_runtime_mod_name_for_trait, generate_method_runtime_api_impl_name,
extract_parameter_names_types_and_borrows, generate_native_call_generator_fn_name,
Expand Down
Loading

0 comments on commit ac9d30a

Please sign in to comment.