mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-24 21:51:08 +00:00
Run cargo fmt on the whole code base (#9394)
* Run cargo fmt on the whole code base * Second run * Add CI check * Fix compilation * More unnecessary braces * Handle weights * Use --all * Use correct attributes... * Fix UI tests * AHHHHHHHHH * 🤦 * Docs * Fix compilation * 🤷 * Please stop * 🤦 x 2 * More * make rustfmt.toml consistent with polkadot Co-authored-by: André Silva <andrerfosilva@gmail.com>
This commit is contained in:
@@ -22,7 +22,9 @@ pub struct HexDisplay<'a>(&'a [u8]);
|
||||
|
||||
impl<'a> HexDisplay<'a> {
|
||||
/// Create new instance that will display `d` as a hex string when displayed.
|
||||
pub fn from<R: AsBytesRef>(d: &'a R) -> Self { HexDisplay(d.as_bytes_ref()) }
|
||||
pub fn from<R: AsBytesRef>(d: &'a R) -> Self {
|
||||
HexDisplay(d.as_bytes_ref())
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> sp_std::fmt::Display for HexDisplay<'a> {
|
||||
@@ -60,15 +62,21 @@ pub trait AsBytesRef {
|
||||
}
|
||||
|
||||
impl AsBytesRef for &[u8] {
|
||||
fn as_bytes_ref(&self) -> &[u8] { self }
|
||||
fn as_bytes_ref(&self) -> &[u8] {
|
||||
self
|
||||
}
|
||||
}
|
||||
|
||||
impl AsBytesRef for [u8] {
|
||||
fn as_bytes_ref(&self) -> &[u8] { &self }
|
||||
fn as_bytes_ref(&self) -> &[u8] {
|
||||
&self
|
||||
}
|
||||
}
|
||||
|
||||
impl AsBytesRef for sp_std::vec::Vec<u8> {
|
||||
fn as_bytes_ref(&self) -> &[u8] { &self }
|
||||
fn as_bytes_ref(&self) -> &[u8] {
|
||||
&self
|
||||
}
|
||||
}
|
||||
|
||||
impl AsBytesRef for sp_storage::StorageKey {
|
||||
@@ -85,9 +93,11 @@ macro_rules! impl_non_endians {
|
||||
)* }
|
||||
}
|
||||
|
||||
impl_non_endians!([u8; 1], [u8; 2], [u8; 3], [u8; 4], [u8; 5], [u8; 6], [u8; 7], [u8; 8],
|
||||
[u8; 10], [u8; 12], [u8; 14], [u8; 16], [u8; 20], [u8; 24], [u8; 28], [u8; 32], [u8; 40],
|
||||
[u8; 48], [u8; 56], [u8; 64], [u8; 65], [u8; 80], [u8; 96], [u8; 112], [u8; 128]);
|
||||
impl_non_endians!(
|
||||
[u8; 1], [u8; 2], [u8; 3], [u8; 4], [u8; 5], [u8; 6], [u8; 7], [u8; 8], [u8; 10], [u8; 12],
|
||||
[u8; 14], [u8; 16], [u8; 20], [u8; 24], [u8; 28], [u8; 32], [u8; 40], [u8; 48], [u8; 56],
|
||||
[u8; 64], [u8; 65], [u8; 80], [u8; 96], [u8; 112], [u8; 128]
|
||||
);
|
||||
|
||||
/// Format into ASCII + # + hex, suitable for storage key preimages.
|
||||
#[cfg(feature = "std")]
|
||||
@@ -103,7 +113,7 @@ pub fn ascii_format(asciish: &[u8]) -> String {
|
||||
latch = true;
|
||||
}
|
||||
r.push_str(&format!("{:02x}", *c));
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
r
|
||||
|
||||
Reference in New Issue
Block a user