Skip to content

Commit

Permalink
Support more address style (#379)
Browse files Browse the repository at this point in the history
* Suppress warnings

* Bump toolchain

* Fix #378
  • Loading branch information
aurexav authored Jan 26, 2023
1 parent dbbad6f commit 9e6242a
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion bin/subalfred/src/command/convert/bytes_style.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ impl BytesStyleCmd {

match (from, to) {
(ByteStringLiteral, ByteStringLiteral) | (VecString, VecString) => {
println!("{}", bytes);
println!("{bytes}");
},
(ByteStringLiteral, VecString) => {
let byte_string_literal = unescaper::unescape(bytes)?;
Expand Down
4 changes: 2 additions & 2 deletions lib/core/src/cargo/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -176,9 +176,9 @@ fn replace_target_versions<'a>(
"{}\"{}\"",
&c[1],
if &c[2] == "polkadot" {
format!("release-v{}", version)
format!("release-v{version}")
} else {
format!("polkadot-v{}", version)
format!("polkadot-v{version}")
}
)
})
Expand Down
3 changes: 2 additions & 1 deletion lib/core/src/ss58/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,14 @@ pub fn all(address: &str) -> Result<(Vec<u8>, String, Vec<Address>)> {
fn recover_public_key(address: &str) -> Result<Vec<u8>> {
match address.len() {
// TODO: support more key types
48 | 49 => Ok(subcryptor::public_key_of::<Sr25519>(address).map_err(|e| {
47 | 48 | 49 => Ok(subcryptor::public_key_of::<Sr25519>(address).map_err(|e| {
error::Ss58::InvalidAddress {
address: address.into(),
source: Some(error::Ss58InvalidAddressSource::Subcryptor(e)),
}
})?),
len => {
dbg!(2);
if (len == 64 && !address.starts_with("0x")) || (len == 66 && address.starts_with("0x"))
{
Ok(array_bytes::hex2bytes(address).map_err(|e| error::Ss58::InvalidAddress {
Expand Down
2 changes: 1 addition & 1 deletion lib/core/src/ss58/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ fn recover_public_key_should_work() {
#[test]
fn recover_public_key_should_fail() {
let address = "";
let expected = Err(format!("[core::ss58] invalid address, {:?}", address));
let expected = Err(format!("[core::ss58] invalid address, {address:?}"));

assert_eq!(recover_public_key(address).map_err(|e| e.to_string()), expected);
}
2 changes: 1 addition & 1 deletion rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[toolchain]
channel = "nightly-2022-09-19"
channel = "nightly"
components = ["cargo", "clippy", "rustc", "rustfmt", "rust-src"]
profile = "minimal"

0 comments on commit 9e6242a

Please sign in to comment.