post rustfmt whitespace fixup (#9436)

Taking best bits of rustfmt's format_strings

Co-authored-by: Alexander Popiak <alexander.popiak@gmail.com>
This commit is contained in:
Squirrel
2021-07-26 14:18:27 +01:00
committed by GitHub
parent ec047abbcf
commit 492523f1ae
18 changed files with 49 additions and 58 deletions
@@ -121,8 +121,8 @@ pub fn run() -> sc_cli::Result<()> {
runner.sync_run(|config| cmd.run::<Block, service::Executor>(config)) runner.sync_run(|config| cmd.run::<Block, service::Executor>(config))
} else { } else {
Err("Benchmarking wasn't enabled when building the node. \ Err("Benchmarking wasn't enabled when building the node. You can enable it with \
You can enable it with `--features runtime-benchmarks`." `--features runtime-benchmarks`."
.into()) .into())
}, },
None => { None => {
+2 -2
View File
@@ -40,8 +40,8 @@ criterion_main!(benches);
/// The wasm runtime code. /// The wasm runtime code.
pub fn compact_code_unwrap() -> &'static [u8] { pub fn compact_code_unwrap() -> &'static [u8] {
node_runtime::WASM_BINARY.expect( node_runtime::WASM_BINARY.expect(
"Development wasm binary is not available. \ "Development wasm binary is not available. Testing is only supported with the flag \
Testing is only supported with the flag disabled.", disabled.",
) )
} }
+2 -2
View File
@@ -71,8 +71,8 @@ impl AppCrypto<MultiSigner, MultiSignature> for TestAuthorityId {
/// runtime. /// runtime.
pub fn compact_code_unwrap() -> &'static [u8] { pub fn compact_code_unwrap() -> &'static [u8] {
node_runtime::WASM_BINARY.expect( node_runtime::WASM_BINARY.expect(
"Development wasm binary is not available. \ "Development wasm binary is not available. Testing is only supported with the flag \
Testing is only supported with the flag disabled.", disabled.",
) )
} }
+3 -3
View File
@@ -101,9 +101,9 @@ include!(concat!(env!("OUT_DIR"), "/wasm_binary.rs"));
#[cfg(feature = "std")] #[cfg(feature = "std")]
pub fn wasm_binary_unwrap() -> &'static [u8] { pub fn wasm_binary_unwrap() -> &'static [u8] {
WASM_BINARY.expect( WASM_BINARY.expect(
"Development wasm binary is not available. This means the client is \ "Development wasm binary is not available. This means the client is built with \
built with `SKIP_WASM_BUILD` flag and it is only usable for \ `SKIP_WASM_BUILD` flag and it is only usable for production chains. Please rebuild with \
production chains. Please rebuild with the flag disabled.", the flag disabled.",
) )
} }
+4 -5
View File
@@ -487,10 +487,9 @@ fn rpc_interface(
) -> Result<IpAddr> { ) -> Result<IpAddr> {
if is_external && is_validator && rpc_methods != RpcMethods::Unsafe { if is_external && is_validator && rpc_methods != RpcMethods::Unsafe {
return Err(Error::Input( return Err(Error::Input(
"--rpc-external and --ws-external options shouldn't be \ "--rpc-external and --ws-external options shouldn't be used if the node is running as \
used if the node is running as a validator. Use `--unsafe-rpc-external` \ a validator. Use `--unsafe-rpc-external` or `--rpc-methods=unsafe` if you understand \
or `--rpc-methods=unsafe` if you understand the risks. See the options \ the risks. See the options description for more information."
description for more information."
.to_owned(), .to_owned(),
)) ))
} }
@@ -499,7 +498,7 @@ fn rpc_interface(
if rpc_methods == RpcMethods::Unsafe { if rpc_methods == RpcMethods::Unsafe {
log::warn!( log::warn!(
"It isn't safe to expose RPC publicly without a proxy server that filters \ "It isn't safe to expose RPC publicly without a proxy server that filters \
available set of RPC methods." available set of RPC methods."
); );
} }
+1 -2
View File
@@ -108,8 +108,7 @@ fn slot_author<P: Pair>(slot: Slot, authorities: &[AuthorityId<P>]) -> Option<&A
); );
let current_author = authorities.get(idx as usize).expect( let current_author = authorities.get(idx as usize).expect(
"authorities not empty; index constrained to list length;\ "authorities not empty; index constrained to list length;this is a valid index; qed",
this is a valid index; qed",
); );
Some(current_author) Some(current_author)
+5 -10
View File
@@ -1340,8 +1340,7 @@ where
} }
let pre_digest = find_pre_digest::<Block>(&block.header).expect( let pre_digest = find_pre_digest::<Block>(&block.header).expect(
"valid babe headers must contain a predigest; \ "valid babe headers must contain a predigest; header has been already verified; qed",
header has been already verified; qed",
); );
let slot = pre_digest.slot(); let slot = pre_digest.slot();
@@ -1357,8 +1356,8 @@ where
})?; })?;
let parent_slot = find_pre_digest::<Block>(&parent_header).map(|d| d.slot()).expect( let parent_slot = find_pre_digest::<Block>(&parent_header).map(|d| d.slot()).expect(
"parent is non-genesis; valid BABE headers contain a pre-digest; \ "parent is non-genesis; valid BABE headers contain a pre-digest; header has already \
header has already been verified; qed", been verified; qed",
); );
// make sure that slot number is strictly increasing // make sure that slot number is strictly increasing
@@ -1581,15 +1580,11 @@ where
.header(BlockId::Hash(info.finalized_hash)) .header(BlockId::Hash(info.finalized_hash))
.map_err(|e| ConsensusError::ClientImport(format!("{:?}", e)))? .map_err(|e| ConsensusError::ClientImport(format!("{:?}", e)))?
.expect( .expect(
"best finalized hash was given by client; \ "best finalized hash was given by client; finalized headers must exist in db; qed",
finalized headers must exist in db; qed",
); );
find_pre_digest::<Block>(&finalized_header) find_pre_digest::<Block>(&finalized_header)
.expect( .expect("finalized header must be valid; valid blocks have a pre-digest; qed")
"finalized header must be valid; \
valid blocks have a pre-digest; qed",
)
.slot() .slot()
}; };
@@ -284,8 +284,8 @@ impl<Block: BlockT> DbChangesTrieStorage<Block> {
pub fn post_commit(&self, tx: Option<DbChangesTrieStorageTransaction<Block>>) { pub fn post_commit(&self, tx: Option<DbChangesTrieStorageTransaction<Block>>) {
if let Some(tx) = tx { if let Some(tx) = tx {
self.cache.0.write().commit(tx.cache_ops).expect( self.cache.0.write().commit(tx.cache_ops).expect(
"only fails if cache with given name isn't loaded yet;\ "only fails if cache with given name isn't loaded yet; cache is already loaded \
cache is already loaded because there is tx; qed", because there is tx; qed",
); );
} }
} }
+4 -4
View File
@@ -518,8 +518,8 @@ where
self.db.commit(transaction)?; self.db.commit(transaction)?;
cache.commit(cache_ops).expect( cache.commit(cache_ops).expect(
"only fails if cache with given name isn't loaded yet;\ "only fails if cache with given name isn't loaded yet; cache is already loaded \
cache is already loaded because there are cache_ops; qed", because there are cache_ops; qed",
); );
} }
@@ -569,8 +569,8 @@ where
self.db.commit(transaction)?; self.db.commit(transaction)?;
cache.commit(cache_ops).expect( cache.commit(cache_ops).expect(
"only fails if cache with given name isn't loaded yet;\ "only fails if cache with given name isn't loaded yet; cache is already loaded \
cache is already loaded because there are cache_ops; qed", because there are cache_ops; qed",
); );
} }
self.update_meta(hash, header.number().clone(), false, true); self.update_meta(hash, header.number().clone(), false, true);
@@ -8,8 +8,8 @@ include!(concat!(env!("OUT_DIR"), "/wasm_binary.rs"));
#[cfg(feature = "std")] #[cfg(feature = "std")]
pub fn wasm_binary_unwrap() -> &'static [u8] { pub fn wasm_binary_unwrap() -> &'static [u8] {
WASM_BINARY.expect( WASM_BINARY.expect(
"Development wasm binary is not available. Testing is only \ "Development wasm binary is not available. Testing is only supported with the flag \
supported with the flag disabled.", disabled.",
) )
} }
+3 -4
View File
@@ -1016,10 +1016,9 @@ where
})?; })?;
let voters = Arc::new(VoterSet::new(new.authorities.into_iter()).expect( let voters = Arc::new(VoterSet::new(new.authorities.into_iter()).expect(
"new authorities come from pending change; \ "new authorities come from pending change; pending change comes from \
pending change comes from `AuthoritySet`; \ `AuthoritySet`; `AuthoritySet` validates authorities is non-empty and \
`AuthoritySet` validates authorities is non-empty and weights are non-zero; \ weights are non-zero; qed.",
qed.",
)); ));
self.env = Arc::new(Environment { self.env = Arc::new(Environment {
+4 -5
View File
@@ -485,11 +485,10 @@ impl NetworkBehaviour for DiscoveryBehaviour {
.map(|(p, k)| (p.clone(), NetworkBehaviour::new_handler(k))); .map(|(p, k)| (p.clone(), NetworkBehaviour::new_handler(k)));
IntoMultiHandler::try_from_iter(iter).expect( IntoMultiHandler::try_from_iter(iter).expect(
"There can be at most one handler per `ProtocolId` and \ "There can be at most one handler per `ProtocolId` and protocol names contain the \
protocol names contain the `ProtocolId` so no two protocol \ `ProtocolId` so no two protocol names in `self.kademlias` can be equal which is the \
names in `self.kademlias` can be equal which is the only error \ only error `try_from_iter` can return, therefore this call is guaranteed to succeed; \
`try_from_iter` can return, therefore this call is guaranteed \ qed",
to succeed; qed",
) )
} }
@@ -364,8 +364,8 @@ impl NetworkBehaviour for RequestResponsesBehaviour {
.map(|(p, (r, _))| (p.to_string(), NetworkBehaviour::new_handler(r))); .map(|(p, (r, _))| (p.to_string(), NetworkBehaviour::new_handler(r)));
MultiHandler::try_from_iter(iter).expect( MultiHandler::try_from_iter(iter).expect(
"Protocols are in a HashMap and there can be at most one handler per \ "Protocols are in a HashMap and there can be at most one handler per protocol name, \
protocol name, which is the only possible error; qed", which is the only possible error; qed",
) )
} }
@@ -1072,8 +1072,8 @@ where
// telemetry once about the finalized block. // telemetry once about the finalized block.
if let Some(last) = notify_finalized.last() { if let Some(last) = notify_finalized.last() {
let header = self.header(&BlockId::Hash(*last))?.expect( let header = self.header(&BlockId::Hash(*last))?.expect(
"Header already known to exist in DB because it is \ "Header already known to exist in DB because it is indicated in the tree route; \
indicated in the tree route; qed", qed",
); );
telemetry!( telemetry!(
@@ -1087,8 +1087,8 @@ where
for finalized_hash in notify_finalized { for finalized_hash in notify_finalized {
let header = self.header(&BlockId::Hash(finalized_hash))?.expect( let header = self.header(&BlockId::Hash(finalized_hash))?.expect(
"Header already known to exist in DB because it is \ "Header already known to exist in DB because it is indicated in the tree route; \
indicated in the tree route; qed", qed",
); );
let notification = FinalityNotification { header, hash: finalized_hash }; let notification = FinalityNotification { header, hash: finalized_hash };
@@ -353,8 +353,8 @@ fn generate_piecewise_linear(points: Vec<(u32, u32)>) -> TokenStream2 {
for (x, y) in points { for (x, y) in points {
let error = || { let error = || {
panic!( panic!(
"Generated reward curve approximation doesn't fit into [0, 1] -> [0, 1] \ "Generated reward curve approximation doesn't fit into [0, 1] -> [0, 1] because \
because of point: of point:
x = {:07} per million x = {:07} per million
y = {:07} per million", y = {:07} per million",
x, y x, y
@@ -157,8 +157,8 @@ pub(crate) fn balance_voter<AccountId: IdentifierT>(
let last_stake = elected_edges let last_stake = elected_edges
.get(last_index) .get(last_index)
.expect( .expect(
"length of elected_edges is greater than or equal 2; last_index index is at \ "length of elected_edges is greater than or equal 2; last_index index is at the \
the minimum elected_edges.len() - 1; index is within range; qed", minimum elected_edges.len() - 1; index is within range; qed",
) )
.candidate .candidate
.borrow() .borrow()
@@ -30,8 +30,8 @@ include!(concat!(env!("OUT_DIR"), "/wasm_binary.rs"));
#[cfg(feature = "std")] #[cfg(feature = "std")]
pub fn wasm_binary_unwrap() -> &'static [u8] { pub fn wasm_binary_unwrap() -> &'static [u8] {
WASM_BINARY.expect( WASM_BINARY.expect(
"Development wasm binary is not available. Testing is only \ "Development wasm binary is not available. Testing is only supported with the flag \
supported with the flag disabled.", disabled.",
) )
} }
+3 -3
View File
@@ -76,8 +76,8 @@ pub mod wasm_binary_logging_disabled {
#[cfg(feature = "std")] #[cfg(feature = "std")]
pub fn wasm_binary_unwrap() -> &'static [u8] { pub fn wasm_binary_unwrap() -> &'static [u8] {
WASM_BINARY.expect( WASM_BINARY.expect(
"Development wasm binary is not available. Testing is only \ "Development wasm binary is not available. Testing is only supported with the flag \
supported with the flag disabled.", disabled.",
) )
} }
@@ -86,7 +86,7 @@ pub fn wasm_binary_unwrap() -> &'static [u8] {
pub fn wasm_binary_logging_disabled_unwrap() -> &'static [u8] { pub fn wasm_binary_logging_disabled_unwrap() -> &'static [u8] {
wasm_binary_logging_disabled::WASM_BINARY.expect( wasm_binary_logging_disabled::WASM_BINARY.expect(
"Development wasm binary is not available. Testing is only supported with the flag \ "Development wasm binary is not available. Testing is only supported with the flag \
disabled.", disabled.",
) )
} }