mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-09 20:11:09 +00:00
Migrate everything to the 2018 edition (#1758)
This commit is contained in:
committed by
Gav Wood
parent
a61c218cc3
commit
ff5e4ca87e
@@ -2,6 +2,7 @@
|
||||
name = "sr-api-macros"
|
||||
version = "0.1.0"
|
||||
authors = ["Parity Technologies <admin@parity.io>"]
|
||||
edition = "2018"
|
||||
|
||||
[lib]
|
||||
proc-macro = true
|
||||
@@ -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"
|
||||
|
||||
@@ -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};
|
||||
|
||||
@@ -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;
|
||||
@@ -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;
|
||||
@@ -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! {
|
||||
@@ -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! {
|
||||
@@ -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! {
|
||||
@@ -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! {
|
||||
@@ -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! {
|
||||
@@ -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;
|
||||
@@ -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;
|
||||
@@ -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;
|
||||
@@ -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;
|
||||
@@ -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;
|
||||
@@ -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;
|
||||
@@ -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;
|
||||
|
||||
@@ -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,
|
||||
@@ -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) => {
|
||||
@@ -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> );
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -18,11 +18,6 @@
|
||||
|
||||
#![recursion_limit = "512"]
|
||||
extern crate proc_macro;
|
||||
extern crate proc_macro2;
|
||||
extern crate quote;
|
||||
extern crate syn;
|
||||
extern crate blake2_rfc;
|
||||
extern crate proc_macro_crate;
|
||||
|
||||
use proc_macro::TokenStream;
|
||||
|
||||
@@ -51,13 +46,13 @@ mod compile_fail_tests;
|
||||
///
|
||||
/// ```rust
|
||||
/// #[macro_use]
|
||||
/// extern crate substrate_client;
|
||||
/// extern crate client;
|
||||
/// extern crate sr_version as version;
|
||||
///
|
||||
/// use version::create_runtime_str;
|
||||
/// # extern crate substrate_test_client as test_client;
|
||||
/// # extern crate sr_primitives as runtime_primitives;
|
||||
/// # extern crate substrate_primitives as primitives;
|
||||
/// # extern crate test_client;
|
||||
/// # extern crate runtime_primitives;
|
||||
/// # extern crate substrate_primitives;
|
||||
/// #
|
||||
/// # use runtime_primitives::traits::GetNodeBlockType;
|
||||
/// # use test_client::runtime::Block;
|
||||
@@ -133,7 +128,7 @@ pub fn impl_runtime_apis(input: TokenStream) -> TokenStream {
|
||||
///
|
||||
/// ```rust
|
||||
/// #[macro_use]
|
||||
/// extern crate substrate_client;
|
||||
/// extern crate client;
|
||||
///
|
||||
/// decl_runtime_apis! {
|
||||
/// /// Declare the api trait.
|
||||
@@ -168,7 +163,7 @@ pub fn impl_runtime_apis(input: TokenStream) -> TokenStream {
|
||||
///
|
||||
/// ```rust
|
||||
/// #[macro_use]
|
||||
/// extern crate substrate_client;
|
||||
/// extern crate client;
|
||||
///
|
||||
/// decl_runtime_apis! {
|
||||
/// /// Declare the api trait.
|
||||
|
||||
@@ -1,13 +1,23 @@
|
||||
#[macro_use]
|
||||
extern crate substrate_client as client;
|
||||
extern crate sr_primitives as runtime_primitives;
|
||||
extern crate substrate_primitives as primitives;
|
||||
extern crate substrate_test_client as test_client;
|
||||
// Copyright 2019 Parity Technologies (UK) Ltd.
|
||||
// This file is part of Substrate.
|
||||
|
||||
// Substrate is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
|
||||
// Substrate is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Substrate. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
use runtime_primitives::traits::{GetNodeBlockType, Block as BlockT, AuthorityIdFor};
|
||||
use runtime_primitives::generic::BlockId;
|
||||
use client::runtime_api::{self, RuntimeApiInfo};
|
||||
use client::error::Result;
|
||||
use client::{error::Result, decl_runtime_apis, impl_runtime_apis};
|
||||
use test_client::runtime::Block;
|
||||
|
||||
/// The declaration of the `Runtime` type and the implementation of the `GetNodeBlockType`
|
||||
|
||||
@@ -14,11 +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 substrate_client;
|
||||
extern crate substrate_test_client as test_client;
|
||||
extern crate sr_primitives as runtime_primitives;
|
||||
extern crate substrate_state_machine as state_machine;
|
||||
|
||||
use test_client::runtime::{TestAPI, DecodeFails};
|
||||
use runtime_primitives::{generic::BlockId, traits::ProvideRuntimeApi};
|
||||
use state_machine::ExecutionStrategy;
|
||||
|
||||
Reference in New Issue
Block a user