Fix clippy bits

This commit is contained in:
James Wilson
2025-12-16 16:06:02 +00:00
parent e9bb756605
commit c1d30da488
14 changed files with 47 additions and 29 deletions
+3 -3
View File
@@ -50,7 +50,7 @@ impl<T: Config> Backend<T> for ArchiveBackend<T> {
let queries = keys
.into_iter()
.map(|key| ArchiveStorageQuery {
key: key,
key,
query_type: StorageQueryType::Value,
pagination_start_key: None,
})
@@ -77,7 +77,7 @@ impl<T: Config> Backend<T> for ArchiveBackend<T> {
at: HashFor<T>,
) -> Result<StreamOfResults<Vec<u8>>, BackendError> {
let queries = std::iter::once(ArchiveStorageQuery {
key: key,
key,
// Just ask for the hash and then ignore it and return keys
query_type: StorageQueryType::DescendantsHashes,
pagination_start_key: None,
@@ -99,7 +99,7 @@ impl<T: Config> Backend<T> for ArchiveBackend<T> {
at: HashFor<T>,
) -> Result<StreamOfResults<StorageResponse>, BackendError> {
let queries = std::iter::once(ArchiveStorageQuery {
key: key,
key,
query_type: StorageQueryType::DescendantsValues,
pagination_start_key: None,
})
+7 -1
View File
@@ -31,6 +31,12 @@ enum BackendChoice<V> {
UseDefault,
}
impl<T: Config> Default for CombinedBackendBuilder<T> {
fn default() -> Self {
Self::new()
}
}
impl<T: Config> CombinedBackendBuilder<T> {
/// Create a new [`CombinedBackendBuilder`].
pub fn new() -> Self {
@@ -438,7 +444,7 @@ where
"None of the configured backends are capable of handling this request";
let mut err = BackendError::other(NO_AVAILABLE_BACKEND);
for backend in backends.into_iter().filter_map(|b| *b) {
for backend in backends.iter().filter_map(|b| *b) {
match f(backend).await {
Ok(res) => return Ok(res),
Err(e) => err = e,
+2 -2
View File
@@ -286,7 +286,7 @@ impl<T: Config> Backend<T> for LegacyBackend<T> {
let last_finalized_block_num = this
.block_header(last_finalized_block_ref.hash())
.await?
.map(|h| h.number().into());
.map(|h| h.number());
// Fill in any missing blocks, because the backend may not emit every finalized block; just the latest ones which
// are finalized each time.
@@ -408,7 +408,7 @@ where
};
// We want all previous details up to, but not including this current block num.
let end_block_num = header.number().into();
let end_block_num = header.number();
// This is one after the last block we returned details for last time.
let start_block_num = last_block_num.map(|n| n + 1).unwrap_or(end_block_num);
+1 -1
View File
@@ -120,7 +120,7 @@ impl<T: Config> OnlineClient<T> {
inner: Arc::new(OnlineClientInner {
config,
genesis_hash,
backend: backend.into(),
backend,
}),
})
}
+6
View File
@@ -81,6 +81,12 @@ impl PolkadotConfigBuilder {
#[derive(Debug, Clone)]
pub struct PolkadotConfig(SubstrateConfig);
impl Default for PolkadotConfig {
fn default() -> Self {
Self::new()
}
}
impl PolkadotConfig {
/// Create a new, default, [`PolkadotConfig`].
pub fn new() -> Self {
+7 -1
View File
@@ -135,6 +135,12 @@ struct SubstrateConfigInner {
metadata_for_spec_version: Mutex<HashMap<u32, ArcMetadata>>,
}
impl Default for SubstrateConfig {
fn default() -> Self {
Self::new()
}
}
impl SubstrateConfig {
/// Create a new, default, [`SubstrateConfig`]. This does not
/// support working with historic (pre-V14) types. If you want this,
@@ -297,7 +303,7 @@ where
SubstrateHeader<H>: Encode + Decode,
{
fn number(&self) -> u64 {
self.number.into()
self.number
}
}
+3 -3
View File
@@ -134,7 +134,7 @@ impl<'atblock, T: Config, C: OfflineClientAtBlockT<T>> Extrinsics<'atblock, T, C
}
Ok(Extrinsic {
client: client,
client,
index: extrinsic_index,
info: Arc::new(info),
extrinsics: Arc::clone(&all_extrinsic_bytes),
@@ -306,7 +306,7 @@ where
self.metadata.types(),
)
.map_err(|e| ExtrinsicError::CannotDecodeIntoRootExtrinsic {
extrinsic_index: self.index as usize,
extrinsic_index: self.index,
error: e,
})?;
@@ -347,7 +347,7 @@ where
let decoded =
E::decode_as_fields(bytes, &mut fields, self.metadata.types()).map_err(|e| {
ExtrinsicError::CannotDecodeFields {
extrinsic_index: self.index as usize,
extrinsic_index: self.index,
error: e,
}
})?;
+1 -1
View File
@@ -211,7 +211,7 @@ where
pub fn entry(
&self,
) -> Result<StorageEntry<'atblock, T, Client, address::DynamicAddress>, StorageError> {
let addr = address::dynamic(self.pallet_name.to_owned(), self.entry_name.to_owned());
let addr = address::dynamic(&*self.pallet_name, &*self.entry_name);
StorageEntry::new(self.client, addr)
}
}
+1 -1
View File
@@ -587,7 +587,7 @@ impl<'atblock, T: Config, Client: OfflineClientAtBlockT<T>>
// "is general" + transaction protocol version (5)
(0b01000000 + 5u8).encode_to(&mut encoded_inner);
// Encode versions for the transaction extensions
(tx_extensions_version as u8).encode_to(&mut encoded_inner);
tx_extensions_version.encode_to(&mut encoded_inner);
// Encode the actual transaction extensions values
self.additional_and_extra_params
.encode_value_to(&mut encoded_inner);
+1 -1
View File
@@ -206,7 +206,7 @@ pub fn dynamic<CallData>(
call_name: impl Into<String>,
call_data: CallData,
) -> DynamicPayload<CallData> {
StaticPayload::new(pallet_name, call_name, call_data.into())
StaticPayload::new(pallet_name, call_name, call_data)
}
#[cfg(test)]
@@ -323,7 +323,7 @@ impl<'atblock, T: Config, C: OnlineClientAtBlockT<T>> TransactionInBlock<'atbloc
.iter()
.position(|ext| {
use crate::config::Hasher;
let hash = hasher.hash(&ext);
let hash = hasher.hash(ext);
hash == self.ext_hash
})
// If we successfully obtain the block hash we think contains our
+2 -2
View File
@@ -103,9 +103,9 @@ where
{
/// Execute a raw View function API call. This returns the raw bytes representing the result
/// of this call. The caller is responsible for decoding the result.
pub async fn call_raw<'a>(
pub async fn call_raw(
&self,
call_parameters: Option<&'a [u8]>,
call_parameters: Option<&[u8]>,
) -> Result<Vec<u8>, ViewFunctionError> {
let client = &self.client;
let block_hash = client.block_hash();