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:
Tomasz Drwięga
2019-12-10 14:21:34 +01:00
committed by Bastian Köcher
parent 057e298b1f
commit 1f84d6d41d
25 changed files with 104 additions and 87 deletions
@@ -16,10 +16,7 @@
/// Contains the inherents for the AURA module
use sp_timestamp::TimestampInherentData;
use inherents::{InherentIdentifier, InherentData, Error};
use sp_std::result::Result;
use codec::Decode;
#[cfg(feature = "std")]
use inherents::{InherentDataProviders, ProvideInherentData};
@@ -86,12 +83,16 @@ impl ProvideInherentData for InherentDataProvider {
&self,
inherent_data: &mut InherentData,
) ->Result<(), Error> {
use sp_timestamp::TimestampInherentData;
let timestamp = inherent_data.timestamp_inherent_data()?;
let slot_num = timestamp / self.slot_duration;
inherent_data.put_data(INHERENT_IDENTIFIER, &slot_num)
}
fn error_to_string(&self, error: &[u8]) -> Option<String> {
use codec::Decode;
inherents::Error::decode(&mut &error[..]).map(|e| e.into_string()).ok()
}
}
+3 -1
View File
@@ -18,7 +18,9 @@
//! Cryptographic utilities.
// end::description[]
use sp_std::{vec::Vec, hash::Hash};
use sp_std::hash::Hash;
#[cfg(feature = "full_crypto")]
use sp_std::vec::Vec;
#[cfg(feature = "std")]
use sp_std::convert::TryInto;
use sp_std::convert::TryFrom;
+3 -1
View File
@@ -770,6 +770,7 @@ mod allocator_impl {
}
}
/// A default panic handler for WASM environment.
#[cfg(all(not(feature = "disable_panic_handler"), not(feature = "std")))]
#[panic_handler]
#[no_mangle]
@@ -781,9 +782,10 @@ pub fn panic(info: &core::panic::PanicInfo) -> ! {
}
}
/// A default OOM handler for WASM environment.
#[cfg(all(not(feature = "disable_oom"), not(feature = "std")))]
#[alloc_error_handler]
pub extern fn oom(_: core::alloc::Layout) -> ! {
pub fn oom(_: core::alloc::Layout) -> ! {
unsafe {
logging::log(LogLevel::Error, "runtime", b"Runtime memory exhausted. Aborting");
core::intrinsics::abort();