mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-26 14:37:57 +00:00
Fix warnings when compiling runtime. (#4332)
* Remove warnings when compiling runtime. * Remove dispatch::Result imports. * Add missing imports. * Fix missing vecs. #4333 * Fix oom function. * Remove superfluous import. * More warnings.
This commit is contained in:
committed by
Bastian Köcher
parent
057e298b1f
commit
1f84d6d41d
@@ -238,7 +238,7 @@ impl ModuleDeclaration {
|
||||
|
||||
fn default_modules(span: Span) -> Vec<ModulePart> {
|
||||
let mut res: Vec<_> = ["Module", "Call", "Storage"]
|
||||
.into_iter()
|
||||
.iter()
|
||||
.map(|name| ModulePart::with_name(name, span))
|
||||
.collect();
|
||||
res.extend(
|
||||
|
||||
@@ -61,21 +61,21 @@ impl<T> Parameter for T where T: Codec + EncodeLike + Clone + Eq + fmt::Debug {}
|
||||
/// ```
|
||||
/// # #[macro_use]
|
||||
/// # extern crate frame_support;
|
||||
/// # use frame_support::dispatch::Result;
|
||||
/// # use frame_support::dispatch;
|
||||
/// # use frame_system::{self as system, Trait, ensure_signed};
|
||||
/// decl_module! {
|
||||
/// pub struct Module<T: Trait> for enum Call where origin: T::Origin {
|
||||
///
|
||||
/// // Private functions are dispatchable, but not available to other
|
||||
/// // SRML modules.
|
||||
/// fn my_function(origin, var: u64) -> Result {
|
||||
/// fn my_function(origin, var: u64) -> dispatch::Result {
|
||||
/// // Your implementation
|
||||
/// Ok(())
|
||||
/// }
|
||||
///
|
||||
/// // Public functions are both dispatchable and available to other
|
||||
/// // SRML modules.
|
||||
/// pub fn my_public_function(origin) -> Result {
|
||||
/// pub fn my_public_function(origin) -> dispatch::Result {
|
||||
/// // Your implementation
|
||||
/// Ok(())
|
||||
/// }
|
||||
@@ -101,12 +101,12 @@ impl<T> Parameter for T where T: Codec + EncodeLike + Clone + Eq + fmt::Debug {}
|
||||
/// ```
|
||||
/// # #[macro_use]
|
||||
/// # extern crate frame_support;
|
||||
/// # use frame_support::dispatch::Result;
|
||||
/// # use frame_support::dispatch;
|
||||
/// # use frame_system::{self as system, Trait, ensure_signed};
|
||||
/// decl_module! {
|
||||
/// pub struct Module<T: Trait> for enum Call where origin: T::Origin {
|
||||
///
|
||||
/// fn my_long_function(origin) -> Result {
|
||||
/// fn my_long_function(origin) -> dispatch::Result {
|
||||
/// // Your implementation
|
||||
/// Ok(())
|
||||
/// }
|
||||
@@ -126,11 +126,11 @@ impl<T> Parameter for T where T: Codec + EncodeLike + Clone + Eq + fmt::Debug {}
|
||||
/// ```
|
||||
/// # #[macro_use]
|
||||
/// # extern crate frame_support;
|
||||
/// # use frame_support::dispatch::Result;
|
||||
/// # use frame_support::dispatch;
|
||||
/// # use frame_system::{self as system, Trait, ensure_signed, ensure_root};
|
||||
/// decl_module! {
|
||||
/// pub struct Module<T: Trait> for enum Call where origin: T::Origin {
|
||||
/// fn my_privileged_function(origin) -> Result {
|
||||
/// fn my_privileged_function(origin) -> dispatch::Result {
|
||||
/// ensure_root(origin)?;
|
||||
/// // Your implementation
|
||||
/// Ok(())
|
||||
@@ -150,7 +150,7 @@ impl<T> Parameter for T where T: Codec + EncodeLike + Clone + Eq + fmt::Debug {}
|
||||
/// ```
|
||||
/// # #[macro_use]
|
||||
/// # extern crate frame_support;
|
||||
/// # use frame_support::dispatch::Result;
|
||||
/// # use frame_support::dispatch;
|
||||
/// # use frame_system::{self as system, ensure_signed};
|
||||
/// # pub struct DefaultInstance;
|
||||
/// # pub trait Instance {}
|
||||
@@ -178,7 +178,7 @@ impl<T> Parameter for T where T: Codec + EncodeLike + Clone + Eq + fmt::Debug {}
|
||||
/// ```
|
||||
/// # #[macro_use]
|
||||
/// # extern crate frame_support;
|
||||
/// # use frame_support::dispatch::Result;
|
||||
/// # use frame_support::dispatch;
|
||||
/// # use frame_system::{self as system, ensure_signed};
|
||||
/// pub trait Trait: system::Trait where Self::AccountId: From<u32> {}
|
||||
///
|
||||
|
||||
@@ -218,7 +218,7 @@ where
|
||||
.unwrap_or_else(|| {
|
||||
match G::from_query_to_optional_value(G::from_optional_value_to_query(None)) {
|
||||
Some(value) => value.encode(),
|
||||
None => vec![],
|
||||
None => Vec::new(),
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -143,7 +143,7 @@ impl<K: FullEncode, V: FullCodec, G: StorageMap<K, V>> storage::StorageMap<K, V>
|
||||
.unwrap_or_else(|| {
|
||||
match G::from_query_to_optional_value(G::from_optional_value_to_query(None)) {
|
||||
Some(value) => value.encode(),
|
||||
None => vec![],
|
||||
None => Vec::new(),
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -127,7 +127,7 @@ impl<T: FullCodec, G: StorageValue<T>> storage::StorageValue<T> for G {
|
||||
.unwrap_or_else(|| {
|
||||
match G::from_query_to_optional_value(G::from_optional_value_to_query(None)) {
|
||||
Some(value) => value.encode(),
|
||||
None => vec![],
|
||||
None => Vec::new(),
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ macro_rules! reserved {
|
||||
($($reserved:ident)*) => {
|
||||
$(
|
||||
mod $reserved {
|
||||
pub use support::dispatch::Result;
|
||||
pub use support::dispatch;
|
||||
|
||||
pub trait Trait {
|
||||
type Origin;
|
||||
@@ -10,16 +10,16 @@ macro_rules! reserved {
|
||||
}
|
||||
|
||||
pub mod system {
|
||||
use support::dispatch::Result;
|
||||
use support::dispatch;
|
||||
|
||||
pub fn ensure_root<R>(_: R) -> Result {
|
||||
pub fn ensure_root<R>(_: R) -> dispatch::Result {
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
support::decl_module! {
|
||||
pub struct Module<T: Trait> for enum Call where origin: T::Origin {
|
||||
fn $reserved(_origin) -> Result { unreachable!() }
|
||||
fn $reserved(_origin) -> dispatch::Result { unreachable!() }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user