[clippy] Fix clippy issues for crate sp-core (#8809)

* Fix clippy issues for crate sp-core

* Update primitives/core/benches/bench.rs

Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>

* Update primitives/core/src/ed25519.rs

Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>

* Remove clippy attributes

* Missed a clippy attribute

* remove clippy attributes for bechmarks as well

Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
This commit is contained in:
Andreas Doerr
2021-05-18 09:38:56 +02:00
committed by GitHub
parent 72a2ad4f4f
commit a68ed7c3d8
12 changed files with 62 additions and 58 deletions
@@ -66,12 +66,12 @@ pub enum StorageKind {
/// that is re-run at block `N(hash2)`.
/// This storage can be used by offchain workers to handle forks
/// and coordinate offchain workers running on different forks.
PERSISTENT = 1,
PERSISTENT = 1_isize,
/// Local storage is revertible and fork-aware. It means that any value
/// set by the offchain worker triggered at block `N(hash1)` is reverted
/// if that block is reverted as non-canonical and is NOT available for the worker
/// that is re-run at block `N(hash2)`.
LOCAL = 2,
LOCAL = 2_isize,
}
impl TryFrom<u32> for StorageKind {
@@ -108,11 +108,11 @@ impl From<HttpRequestId> for u32 {
#[repr(C)]
pub enum HttpError {
/// The requested action couldn't been completed within a deadline.
DeadlineReached = 1,
DeadlineReached = 1_isize,
/// There was an IO Error while processing the request.
IoError = 2,
IoError = 2_isize,
/// The ID of the request is invalid in this context.
Invalid = 3,
Invalid = 3_isize,
}
impl TryFrom<u32> for HttpError {
@@ -34,7 +34,7 @@ impl InMemOffchainStorage {
}
/// Iterate over all key value pairs by reference.
pub fn iter<'a>(&'a self) -> impl Iterator<Item=(&'a Vec<u8>,&'a Vec<u8>)> {
pub fn iter(&self) -> impl Iterator<Item=(&Vec<u8>,&Vec<u8>)> {
self.storage.iter()
}
@@ -247,7 +247,7 @@ impl offchain::Externalities for TestOffchainExt {
fn http_request_start(&mut self, method: &str, uri: &str, meta: &[u8]) -> Result<RequestId, ()> {
let mut state = self.0.write();
let id = RequestId(state.requests.len() as u16);
state.requests.insert(id.clone(), PendingRequest {
state.requests.insert(id, PendingRequest {
method: method.into(),
uri: uri.into(),
meta: meta.into(),