Skip to content

Commit

Permalink
Fix more warnings etc
Browse files Browse the repository at this point in the history
  • Loading branch information
jsdw committed Sep 27, 2024
1 parent 18a05cb commit b86d8d8
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 15 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ jobs:
uses: actions-rs/cargo@v1.0.3
with:
command: check
args: --all-targets --all-features --target wasm32-unknown-unknown
args: --all-targets --no-default-features --features legacy,error-tracing --target wasm32-unknown-unknown

fmt:
name: Cargo fmt
Expand Down
5 changes: 2 additions & 3 deletions src/decoding/extrinsic_type_info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@

use alloc::borrow::Cow;
use alloc::string::String;
use alloc::vec;
use alloc::vec::Vec;
use core::write;

Expand Down Expand Up @@ -469,10 +468,10 @@ const _: () = {
Ok(ExtrinsicSignatureInfo {
address_id: parse_lookup_name("hardcoded::ExtrinsicAddress")?,
signature_id: parse_lookup_name("hardcoded::ExtrinsicSignature")?,
transaction_extension_ids: vec![ExtrinsicInfoArg {
transaction_extension_ids: Vec::from_iter([ExtrinsicInfoArg {
name: Cow::Borrowed("ExtrinsicSignedExtensions"),
id: parse_lookup_name("hardcoded::ExtrinsicSignedExtensions")?,
}],
}]),
})
}
}
Expand Down
17 changes: 8 additions & 9 deletions src/decoding/storage_type_info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@

use alloc::borrow::Cow;
use alloc::borrow::ToOwned;
use alloc::vec;
use alloc::vec::Vec;

/// This is implemented for all metadatas exposed from `frame_metadata` and is responsible for extracting the
Expand Down Expand Up @@ -379,7 +378,7 @@ mod legacy {
path::StorageEntryType::Plain(ty) => {
let value_id = decode_lookup_name_or_err(ty, pallet_name)?;
Ok(StorageInfo {
keys: vec![],
keys: Vec::new(),
value_id,
})
}
Expand All @@ -390,7 +389,7 @@ mod legacy {
let hasher = $to_storage_hasher(hasher);
let value_id = decode_lookup_name_or_err(value, pallet_name)?;
Ok(StorageInfo {
keys: vec![StorageKeyInfo { hasher, key_id }],
keys: Vec::from_iter([StorageKeyInfo { hasher, key_id }]),
value_id,
})
}
Expand All @@ -407,7 +406,7 @@ mod legacy {
let key2_hasher = $to_storage_hasher(key2_hasher);
let value_id = decode_lookup_name_or_err(value, pallet_name)?;
Ok(StorageInfo {
keys: vec![
keys: Vec::from_iter([
StorageKeyInfo {
hasher: key1_hasher,
key_id: key1_id,
Expand All @@ -416,7 +415,7 @@ mod legacy {
hasher: key2_hasher,
key_id: key2_id,
},
],
]),
value_id,
})
}
Expand Down Expand Up @@ -493,7 +492,7 @@ mod legacy {
frame_metadata::v13::StorageEntryType::Plain(ty) => {
let value_id = decode_lookup_name_or_err(ty, pallet_name)?;
Ok(StorageInfo {
keys: vec![],
keys: Vec::new(),
value_id,
})
}
Expand All @@ -504,7 +503,7 @@ mod legacy {
let hasher = to_storage_hasher_v13(hasher);
let value_id = decode_lookup_name_or_err(value, pallet_name)?;
Ok(StorageInfo {
keys: vec![StorageKeyInfo { hasher, key_id }],
keys: Vec::from_iter([StorageKeyInfo { hasher, key_id }]),
value_id,
})
}
Expand All @@ -521,7 +520,7 @@ mod legacy {
let key2_hasher = to_storage_hasher_v13(key2_hasher);
let value_id = decode_lookup_name_or_err(value, pallet_name)?;
Ok(StorageInfo {
keys: vec![
keys: Vec::from_iter([
StorageKeyInfo {
hasher: key1_hasher,
key_id: key1_id,
Expand All @@ -530,7 +529,7 @@ mod legacy {
hasher: key2_hasher,
key_id: key2_id,
},
],
]),
value_id,
})
}
Expand Down
3 changes: 1 addition & 2 deletions src/utils/decode_with_error_tracing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@

use alloc::format;
use alloc::string::String;
use alloc::string::ToString;

/// Decode some bytes given a type ID and type resolver, and a visitor which decides the output value.
///
Expand Down Expand Up @@ -56,7 +55,7 @@ where
.map(|v| v.map_context(|id| format!("{id:?}")))
.map_err(|te| DecodeErrorTrace {
original_error: format!("{e:?}"),
tracing_error: te.to_string(),
tracing_error: alloc::string::ToString::to_string(&te),
})?;

// If the above succeeds (we're expecting it to fail), then print the value out here.
Expand Down

0 comments on commit b86d8d8

Please sign in to comment.