Update to 2024 edition (#2001)

* Update to 2024 edition

* Update to 2024 edition; fmt, use<> and remove refs

* async functions
This commit is contained in:
James Wilson
2025-05-09 16:12:18 +01:00
committed by GitHub
parent 98c1d153b6
commit 23c62f3d5d
120 changed files with 399 additions and 322 deletions
+6 -1
View File
@@ -161,7 +161,12 @@ where
2 => u16::decode(cursor)?.into(),
4 => u32::decode(cursor)?.into(),
8 => u64::decode(cursor)?,
_ => return Err(Error::Decode(DecodeError::custom_string(format!("state call AccountNonceApi_account_nonce returned an unexpected number of bytes: {} (expected 2, 4 or 8)", account_nonce_bytes.len()))))
_ => {
return Err(Error::Decode(DecodeError::custom_string(format!(
"state call AccountNonceApi_account_nonce returned an unexpected number of bytes: {} (expected 2, 4 or 8)",
account_nonce_bytes.len()
))));
}
};
Ok(account_nonce)
}
+4 -4
View File
@@ -3,7 +3,7 @@
// see LICENSE for license details.
use crate::{
blocks::block_types::{get_events, CachedEvents},
blocks::block_types::{CachedEvents, get_events},
client::{OfflineClientT, OnlineClientT},
config::{Config, HashFor},
error::Error,
@@ -81,7 +81,7 @@ where
/// If an error occurs, all subsequent iterations return `None`.
pub fn find<E: StaticExtrinsic>(
&self,
) -> impl Iterator<Item = Result<FoundExtrinsic<T, C, E>, Error>> + '_ {
) -> impl Iterator<Item = Result<FoundExtrinsic<T, C, E>, Error>> {
self.inner.find::<E>().map(|res| {
match res {
Err(e) => Err(Error::from(e)),
@@ -308,7 +308,7 @@ impl<T: Config> ExtrinsicEvents<T> {
///
/// This works in the same way that [`events::Events::iter()`] does, with the
/// exception that it filters out events not related to the submitted extrinsic.
pub fn iter(&self) -> impl Iterator<Item = Result<events::EventDetails<T>, Error>> + '_ {
pub fn iter(&self) -> impl Iterator<Item = Result<events::EventDetails<T>, Error>> {
self.events.iter().filter(|ev| {
ev.as_ref()
.map(|ev| ev.phase() == events::Phase::ApplyExtrinsic(self.idx))
@@ -320,7 +320,7 @@ impl<T: Config> ExtrinsicEvents<T> {
///
/// This works in the same way that [`events::Events::find()`] does, with the
/// exception that it filters out events not related to the submitted extrinsic.
pub fn find<Ev: events::StaticEvent>(&self) -> impl Iterator<Item = Result<Ev, Error>> + '_ {
pub fn find<Ev: events::StaticEvent>(&self) -> impl Iterator<Item = Result<Ev, Error>> {
self.iter()
.filter_map(|ev| ev.and_then(|ev| ev.as_event::<Ev>()).transpose())
}