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
@@ -18,9 +18,8 @@
//! Implementation of the `inspect-node-key` subcommand
use crate::{Error, NetworkSchemeFlag};
use std::fs;
use libp2p::identity::{PublicKey, ed25519};
use std::path::PathBuf;
use libp2p::identity::{ed25519, PublicKey};
use std::{fs, path::PathBuf};
use structopt::StructOpt;
/// The `inspect-node-key` command
@@ -42,10 +41,10 @@ pub struct InspectNodeKeyCmd {
impl InspectNodeKeyCmd {
/// runs the command
pub fn run(&self) -> Result<(), Error> {
let mut file_content = hex::decode(fs::read(&self.file)?)
.map_err(|_| "failed to decode secret as hex")?;
let secret = ed25519::SecretKey::from_bytes(&mut file_content)
.map_err(|_| "Bad node key file")?;
let mut file_content =
hex::decode(fs::read(&self.file)?).map_err(|_| "failed to decode secret as hex")?;
let secret =
ed25519::SecretKey::from_bytes(&mut file_content).map_err(|_| "Bad node key file")?;
let keypair = ed25519::Keypair::from(secret);
let peer_id = PublicKey::Ed25519(keypair.public()).into_peer_id();
@@ -58,8 +57,7 @@ impl InspectNodeKeyCmd {
#[cfg(test)]
mod tests {
use super::*;
use super::super::GenerateNodeKeyCmd;
use super::{super::GenerateNodeKeyCmd, *};
#[test]
fn inspect_node_key() {