rustfmt ghost client cli and fix typos

Signed-off-by: Uncle Stretch <uncle.stretch@ghostchain.io>
This commit is contained in:
Uncle Stretch
2025-07-29 15:02:07 +03:00
parent a74e42369b
commit 767161ac9c
9 changed files with 598 additions and 569 deletions

View File

@@ -21,19 +21,25 @@ pub struct InnerSs58AddressFormat(Ss58AddressFormat);
impl InnerSs58AddressFormat {
#[inline]
pub fn custom(prefix: u16) -> Self {
Self { 0: Ss58AddressFormat::custom(prefix) }
Self {
0: Ss58AddressFormat::custom(prefix),
}
}
}
impl std::fmt::Display for InnerSs58AddressFormat {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
write!(f, "{} network", ALL_POSSIBLE_IDS
.binary_search(&u16::from(self.0))
.expect("always be found"))
write!(
f,
"{} network",
ALL_POSSIBLE_IDS
.binary_search(&u16::from(self.0))
.expect("always be found")
)
}
}
impl<'a>TryFrom<&'a str> for InnerSs58AddressFormat {
impl<'a> TryFrom<&'a str> for InnerSs58AddressFormat {
type Error = ParseError;
fn try_from(x: &'a str) -> Result<Self, Self::Error> {
@@ -44,13 +50,13 @@ impl<'a>TryFrom<&'a str> for InnerSs58AddressFormat {
}
}
pub fn parse_s58_prefix_address_format(x: &str,) -> Result<Ss58AddressFormat, String> {
pub fn parse_s58_prefix_address_format(x: &str) -> Result<Ss58AddressFormat, String> {
match InnerSs58AddressFormat::try_from(x) {
Ok(format_registry) => Ok(format_registry.0.into()),
Err(_) => Err(format!(
"Unable to parse variant. Known variants: {:?}",
&ALL_POSSIBLE_NAMES
))
)),
}
}