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:
Bastian Köcher
2021-07-21 16:32:32 +02:00
committed by GitHub
parent d451c38c1c
commit 7b56ab15b4
1010 changed files with 53339 additions and 51208 deletions
+11 -20
View File
@@ -5,7 +5,7 @@
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// This program is distributed in the hope that it will be useful,
@@ -19,7 +19,7 @@
//! implementation of the `verify` subcommand
use crate::{error, utils, with_crypto_scheme, CryptoSchemeFlag};
use sp_core::{Public, crypto::Ss58Codec};
use sp_core::{crypto::Ss58Codec, Public};
use structopt::StructOpt;
/// The `verify` command
@@ -57,32 +57,23 @@ impl VerifyCmd {
let message = utils::read_message(self.message.as_ref(), self.hex)?;
let sig_data = utils::decode_hex(&self.sig)?;
let uri = utils::read_uri(self.uri.as_ref())?;
let uri = if uri.starts_with("0x") {
&uri[2..]
} else {
&uri
};
let uri = if uri.starts_with("0x") { &uri[2..] } else { &uri };
with_crypto_scheme!(
self.crypto_scheme.scheme,
verify(sig_data, message, uri)
)
with_crypto_scheme!(self.crypto_scheme.scheme, verify(sig_data, message, uri))
}
}
fn verify<Pair>(sig_data: Vec<u8>, message: Vec<u8>, uri: &str) -> error::Result<()>
where
Pair: sp_core::Pair,
Pair::Signature: Default + AsMut<[u8]>,
where
Pair: sp_core::Pair,
Pair::Signature: Default + AsMut<[u8]>,
{
let mut signature = Pair::Signature::default();
if sig_data.len() != signature.as_ref().len() {
return Err(
error::Error::SignatureInvalidLength {
read: sig_data.len(),
expected: signature.as_ref().len(),
}
);
return Err(error::Error::SignatureInvalidLength {
read: sig_data.len(),
expected: signature.as_ref().len(),
})
}
signature.as_mut().copy_from_slice(&sig_data);