Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Commit

Permalink
Allow deprecated in tests
Browse files Browse the repository at this point in the history
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
  • Loading branch information
ggwpez committed Mar 24, 2023
1 parent 1cb3433 commit ce36080
Show file tree
Hide file tree
Showing 19 changed files with 63 additions and 0 deletions.
4 changes: 4 additions & 0 deletions frame/support/src/dispatch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3206,6 +3206,8 @@ macro_rules! __check_reserved_fn_name {
// Do not complain about unused `dispatch` and `dispatch_aux`.
#[allow(dead_code)]
mod tests {
#![allow(deprecated)]

use super::*;
use crate::{
dispatch::{DispatchClass, DispatchInfo, Pays},
Expand Down Expand Up @@ -3542,6 +3544,8 @@ mod tests {
// Do not complain about unused `dispatch` and `dispatch_aux`.
#[allow(dead_code)]
mod weight_tests {
#![allow(deprecated)]

use super::*;
use sp_core::{parameter_types, Get};
use sp_weights::RuntimeDbWeight;
Expand Down
2 changes: 2 additions & 0 deletions frame/support/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -826,6 +826,8 @@ pub use serde::{Deserialize, Serialize};

#[cfg(test)]
pub mod tests {
#![allow(deprecated)]

use super::*;
use crate::metadata_ir::{
PalletStorageMetadataIR, StorageEntryMetadataIR, StorageEntryModifierIR,
Expand Down
2 changes: 2 additions & 0 deletions frame/support/src/storage/generator/double_map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -512,6 +512,8 @@ where
/// Test iterators for StorageDoubleMap
#[cfg(test)]
mod test_iterators {
#![allow(deprecated)]

use crate::{
hash::StorageHasher,
storage::{generator::StorageDoubleMap, unhashed, IterableStorageDoubleMap},
Expand Down
2 changes: 2 additions & 0 deletions frame/support/src/storage/generator/map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -347,6 +347,8 @@ impl<K: FullEncode, V: FullCodec, G: StorageMap<K, V>> storage::StorageMap<K, V>
/// Test iterators for StorageMap
#[cfg(test)]
mod test_iterators {
#![allow(deprecated)]

use crate::{
hash::StorageHasher,
storage::{generator::StorageMap, unhashed, IterableStorageMap},
Expand Down
2 changes: 2 additions & 0 deletions frame/support/src/storage/generator/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ pub use value::StorageValue;
#[cfg(test)]
#[allow(dead_code)]
mod tests {
#![allow(deprecated)]

use crate::{
assert_noop, assert_ok,
storage::{generator::StorageValue, unhashed, IterableStorageMap},
Expand Down
2 changes: 2 additions & 0 deletions frame/support/src/storage/generator/nmap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -460,6 +460,8 @@ impl<K: ReversibleKeyGenerator, V: FullCodec, G: StorageNMap<K, V>>
/// Test iterators for StorageNMap
#[cfg(test)]
mod test_iterators {
#![allow(deprecated)]

use crate::{
hash::StorageHasher,
storage::{generator::StorageNMap, unhashed, IterableStorageNMap},
Expand Down
1 change: 1 addition & 0 deletions frame/support/test/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
// Make sure we fail compilation on warnings
#![warn(missing_docs)]
#![deny(warnings)]
#![allow(deprecated)]

/// The configuration trait
pub trait Config: 'static {
Expand Down
9 changes: 9 additions & 0 deletions frame/support/test/tests/construct_runtime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
//! * integrity test is generated
#![recursion_limit = "128"]
#![allow(deprecated)]

use codec::MaxEncodedLen;
use frame_support::{parameter_types, traits::PalletInfo as _};
Expand All @@ -40,6 +41,8 @@ parameter_types! {
}

mod module1 {
#![allow(deprecated)]

use super::*;

pub trait Config<I>: system::Config {}
Expand Down Expand Up @@ -80,6 +83,8 @@ mod module1 {
}

mod module2 {
#![allow(deprecated)]

use super::*;

pub trait Config: system::Config {}
Expand Down Expand Up @@ -125,6 +130,8 @@ mod nested {
use super::*;

pub mod module3 {
#![allow(deprecated)]

use super::*;

pub trait Config: system::Config {}
Expand Down Expand Up @@ -171,6 +178,8 @@ mod nested {
}

pub mod module3 {
#![allow(deprecated)]

use super::*;

pub trait Config: system::Config {}
Expand Down
8 changes: 8 additions & 0 deletions frame/support/test/tests/decl_storage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
// Do not complain about unused `dispatch` and `dispatch_aux`.
#[allow(dead_code)]
mod tests {
#![allow(deprecated)]

use frame_support::metadata_ir::*;
use sp_io::TestExternalities;

Expand Down Expand Up @@ -617,6 +619,8 @@ mod tests {
#[cfg(test)]
#[allow(dead_code)]
mod test2 {
#![allow(deprecated)]

pub trait Config: frame_support_test::Config {}

frame_support::decl_module! {
Expand Down Expand Up @@ -695,6 +699,8 @@ mod test2 {
#[cfg(test)]
#[allow(dead_code)]
mod test3 {
#![allow(deprecated)]

pub trait Config: frame_support_test::Config {}

frame_support::decl_module! {
Expand Down Expand Up @@ -723,6 +729,8 @@ mod test3 {
#[cfg(test)]
#[allow(dead_code)]
mod test_append_and_len {
#![allow(deprecated)]

use codec::{Decode, Encode};
use sp_io::TestExternalities;

Expand Down
4 changes: 4 additions & 0 deletions frame/support/test/tests/final_keys.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ use sp_io::{
};

mod no_instance {
#![allow(deprecated)]

pub trait Config: frame_support_test::Config {}

frame_support::decl_module! {
Expand All @@ -49,6 +51,8 @@ mod no_instance {
}

mod instance {
#![allow(deprecated)]

pub trait Config<I = DefaultInstance>: frame_support_test::Config {}

frame_support::decl_module! {
Expand Down
2 changes: 2 additions & 0 deletions frame/support/test/tests/genesisconfig.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#![allow(deprecated)]

pub trait Config: frame_support_test::Config {}

frame_support::decl_module! {
Expand Down
6 changes: 6 additions & 0 deletions frame/support/test/tests/instance.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
// limitations under the License.

#![recursion_limit = "128"]
#![allow(deprecated)]

use codec::{Codec, Decode, Encode, EncodeLike, MaxEncodedLen};
use frame_support::{
Expand Down Expand Up @@ -43,6 +44,8 @@ pub trait Currency {}
// * No default instance
// * Origin, Inherent, Event
mod module1 {
#![allow(deprecated)]

use super::*;
use sp_std::ops::Add;

Expand Down Expand Up @@ -150,6 +153,7 @@ mod module1 {
// * default instance
// * use of no_genesis_config_phantom_data
mod module2 {
#![allow(deprecated)]
use super::*;

pub trait Config<I = DefaultInstance>: system::Config {
Expand Down Expand Up @@ -218,6 +222,8 @@ mod module2 {
// Test for:
// * Depends on multiple instances of a module with instances
mod module3 {
#![allow(deprecated)]

use super::*;

pub trait Config:
Expand Down
4 changes: 4 additions & 0 deletions frame/support/test/tests/issue2219.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#![allow(deprecated)]

use frame_support::{
codec::{Decode, Encode},
scale_info::TypeInfo,
Expand All @@ -29,6 +31,8 @@ use sp_core::{sr25519, H256};
mod system;

mod module {
#![allow(deprecated)]

use super::*;

pub type Request<T> =
Expand Down
4 changes: 4 additions & 0 deletions frame/support/test/tests/origin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
//! RuntimeOrigin tests for construct_runtime macro
#![recursion_limit = "128"]
#![allow(deprecated)]

use codec::MaxEncodedLen;
use frame_support::traits::{Contains, OriginTrait};
Expand All @@ -31,6 +32,7 @@ mod nested {
use super::*;

pub mod module {
#![allow(deprecated)]

use super::*;

Expand Down Expand Up @@ -74,6 +76,8 @@ mod nested {
}

pub mod module {
#![allow(deprecated)]

use super::*;

pub trait Config: system::Config {}
Expand Down
2 changes: 2 additions & 0 deletions frame/support/test/tests/pallet_compatibility.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ impl SomeAssociation for u64 {
}

mod pallet_old {
#![allow(deprecated)]

use super::SomeAssociation;
use frame_support::{
decl_error, decl_event, decl_module, decl_storage, traits::Get, weights::Weight, Parameter,
Expand Down
2 changes: 2 additions & 0 deletions frame/support/test/tests/pallet_compatibility_instance.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
use frame_support::traits::{ConstU32, ConstU64};

mod pallet_old {
#![allow(deprecated)]

use frame_support::{
decl_error, decl_event, decl_module, decl_storage, traits::Get, weights::Weight, Parameter,
};
Expand Down
2 changes: 2 additions & 0 deletions frame/support/test/tests/pallet_with_name_trait_is_valid.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#![allow(deprecated)]

pub trait Trait: frame_system::Config {
type Balance: frame_support::dispatch::Parameter;
/// The overarching event type.
Expand Down
3 changes: 3 additions & 0 deletions frame/support/test/tests/storage_layers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ pub mod pallet {
}

pub mod decl_pallet {
#![allow(deprecated)]

pub trait Config: frame_system::Config {}

frame_support::decl_module! {
Expand Down Expand Up @@ -267,6 +269,7 @@ fn storage_layer_in_pallet_call() {

#[test]
fn storage_layer_in_decl_pallet_call() {
#![allow(deprecated)]
TestExternalities::default().execute_with(|| {
use frame_support::StorageValue;
use sp_runtime::traits::Dispatchable;
Expand Down
2 changes: 2 additions & 0 deletions frame/support/test/tests/system.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#![allow(deprecated)]

use frame_support::{
codec::{Decode, Encode, EncodeLike},
traits::Get,
Expand Down

0 comments on commit ce36080

Please sign in to comment.