Switch to Rust 2021 (#10170)

* Switch to Rust 2021

* Update trybuild to fix errors
This commit is contained in:
Bastian Köcher
2021-11-04 19:54:48 +01:00
committed by GitHub
parent 9fb9d7b8f0
commit b08d3017a8
245 changed files with 264 additions and 279 deletions
+5 -3
View File
@@ -2,7 +2,7 @@
name = "frame-support-test"
version = "3.0.0"
authors = ["Parity Technologies <admin@parity.io>"]
edition = "2018"
edition = "2021"
license = "Apache-2.0"
publish = false
homepage = "https://substrate.io"
@@ -23,7 +23,7 @@ sp-runtime = { version = "4.0.0-dev", default-features = false, path = "../../..
sp-core = { version = "4.0.0-dev", default-features = false, path = "../../../primitives/core" }
sp-std = { version = "4.0.0-dev", default-features = false, path = "../../../primitives/std" }
sp-version = { version = "4.0.0-dev", default-features = false, path = "../../../primitives/version" }
trybuild = "1.0.43"
trybuild = "1.0.52"
pretty_assertions = "1.0.0"
rustversion = "1.0.0"
frame-system = { version = "4.0.0-dev", default-features = false, path = "../../system" }
@@ -36,13 +36,15 @@ std = [
"serde/std",
"codec/std",
"scale-info/std",
"sp-io/std",
"frame-support/std",
"frame-system/std",
"sp-core/std",
"sp-std/std",
"sp-io/std",
"sp-runtime/std",
"sp-state-machine",
"sp-arithmetic/std",
"sp-version/std",
]
try-runtime = ["frame-support/try-runtime"]
# WARNING: CI only execute pallet test with this feature,
@@ -2,7 +2,7 @@
name = "frame-support-test-compile-pass"
version = "4.0.0-dev"
authors = ["Parity Technologies <admin@parity.io>"]
edition = "2018"
edition = "2021"
license = "Apache-2.0"
publish = false
homepage = "https://substrate.dev"
@@ -2,7 +2,7 @@
name = "frame-support-test-pallet"
version = "4.0.0-dev"
authors = ["Parity Technologies <admin@parity.io>"]
edition = "2018"
edition = "2021"
license = "Apache-2.0"
publish = false
homepage = "https://substrate.io"
+17 -17
View File
@@ -166,25 +166,25 @@ pub mod pallet {
T::AccountId: From<SomeType2> + From<SomeType1> + SomeAssociation1,
{
fn on_initialize(_: BlockNumberFor<T>) -> Weight {
T::AccountId::from(SomeType1); // Test for where clause
T::AccountId::from(SomeType2); // Test for where clause
let _ = T::AccountId::from(SomeType1); // Test for where clause
let _ = T::AccountId::from(SomeType2); // Test for where clause
Self::deposit_event(Event::Something(10));
10
}
fn on_finalize(_: BlockNumberFor<T>) {
T::AccountId::from(SomeType1); // Test for where clause
T::AccountId::from(SomeType2); // Test for where clause
let _ = T::AccountId::from(SomeType1); // Test for where clause
let _ = T::AccountId::from(SomeType2); // Test for where clause
Self::deposit_event(Event::Something(20));
}
fn on_runtime_upgrade() -> Weight {
T::AccountId::from(SomeType1); // Test for where clause
T::AccountId::from(SomeType2); // Test for where clause
let _ = T::AccountId::from(SomeType1); // Test for where clause
let _ = T::AccountId::from(SomeType2); // Test for where clause
Self::deposit_event(Event::Something(30));
30
}
fn integrity_test() {
T::AccountId::from(SomeType1); // Test for where clause
T::AccountId::from(SomeType2); // Test for where clause
let _ = T::AccountId::from(SomeType1); // Test for where clause
let _ = T::AccountId::from(SomeType2); // Test for where clause
}
}
@@ -200,8 +200,8 @@ pub mod pallet {
#[pallet::compact] _foo: u32,
_bar: u32,
) -> DispatchResultWithPostInfo {
T::AccountId::from(SomeType1); // Test for where clause
T::AccountId::from(SomeType3); // Test for where clause
let _ = T::AccountId::from(SomeType1); // Test for where clause
let _ = T::AccountId::from(SomeType3); // Test for where clause
let _ = origin;
Self::deposit_event(Event::Something(3));
Ok(().into())
@@ -268,7 +268,7 @@ pub mod pallet {
where
T::AccountId: From<SomeType7> + From<SomeType1> + SomeAssociation1,
{
T::AccountId::from(SomeType7); // Test where clause works
let _ = T::AccountId::from(SomeType7); // Test where clause works
4u16
}
@@ -352,8 +352,8 @@ pub mod pallet {
T::AccountId: From<SomeType1> + SomeAssociation1 + From<SomeType4>,
{
fn build(&self) {
T::AccountId::from(SomeType1); // Test for where clause
T::AccountId::from(SomeType4); // Test for where clause
let _ = T::AccountId::from(SomeType1); // Test for where clause
let _ = T::AccountId::from(SomeType4); // Test for where clause
}
}
@@ -370,8 +370,8 @@ pub mod pallet {
{
type Call = Call<T>;
fn validate_unsigned(_source: TransactionSource, call: &Self::Call) -> TransactionValidity {
T::AccountId::from(SomeType1); // Test for where clause
T::AccountId::from(SomeType5); // Test for where clause
let _ = T::AccountId::from(SomeType1); // Test for where clause
let _ = T::AccountId::from(SomeType5); // Test for where clause
if matches!(call, Call::foo_transactional { .. }) {
return Ok(ValidTransaction::default())
}
@@ -390,8 +390,8 @@ pub mod pallet {
const INHERENT_IDENTIFIER: InherentIdentifier = INHERENT_IDENTIFIER;
fn create_inherent(_data: &InherentData) -> Option<Self::Call> {
T::AccountId::from(SomeType1); // Test for where clause
T::AccountId::from(SomeType6); // Test for where clause
let _ = T::AccountId::from(SomeType1); // Test for where clause
let _ = T::AccountId::from(SomeType6); // Test for where clause
Some(Call::foo_no_post_info {})
}