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
@@ -17,18 +17,16 @@
// along with this program. If not, see <https://www.gnu.org/licenses/>.
use crate::error::Error;
use log::info;
use futures::{future, prelude::*};
use sp_runtime::traits::{
Block as BlockT, NumberFor, One, Zero, SaturatedConversion
};
use sp_runtime::generic::BlockId;
use codec::Encode;
use futures::{future, prelude::*};
use log::info;
use sp_runtime::{
generic::BlockId,
traits::{Block as BlockT, NumberFor, One, SaturatedConversion, Zero},
};
use std::{io::Write, pin::Pin};
use sc_client_api::{BlockBackend, UsageProvider};
use std::sync::Arc;
use std::task::Poll;
use std::{io::Write, pin::Pin, sync::Arc, task::Poll};
/// Performs the blocks export.
pub fn export_blocks<B, C>(
@@ -36,7 +34,7 @@ pub fn export_blocks<B, C>(
mut output: impl Write + 'static,
from: NumberFor<B>,
to: Option<NumberFor<B>>,
binary: bool
binary: bool,
) -> Pin<Box<dyn Future<Output = Result<(), Error>>>>
where
C: BlockBackend<B> + UsageProvider<B> + 'static,
@@ -63,7 +61,7 @@ where
let client = &client;
if last < block {
return Poll::Ready(Err("Invalid block range specified".into()));
return Poll::Ready(Err("Invalid block range specified".into()))
}
if !wrote_header {
@@ -78,14 +76,13 @@ where
}
match client.block(&BlockId::number(block))? {
Some(block) => {
Some(block) =>
if binary {
output.write_all(&block.encode())?;
} else {
serde_json::to_writer(&mut output, &block)
.map_err(|e| format!("Error writing JSON: {}", e))?;
}
},
},
// Reached end of the chain.
None => return Poll::Ready(Ok(())),
}
@@ -93,7 +90,7 @@ where
info!("#{}", block);
}
if block == last {
return Poll::Ready(Ok(()));
return Poll::Ready(Ok(()))
}
block += One::one();