mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-27 11:38:01 +00:00
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:
@@ -48,10 +48,10 @@ impl From<Error> for rpc::Error {
|
||||
data: serde_json::to_value(h).ok(),
|
||||
},
|
||||
Error::MalformattedPeerArg(ref e) => rpc::Error {
|
||||
code :rpc::ErrorCode::ServerError(BASE_ERROR + 2),
|
||||
code: rpc::ErrorCode::ServerError(BASE_ERROR + 2),
|
||||
message: e.clone(),
|
||||
data: None,
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,9 +18,9 @@
|
||||
|
||||
//! Substrate system API helpers.
|
||||
|
||||
use sc_chain_spec::{ChainType, Properties};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::fmt;
|
||||
use serde::{Serialize, Deserialize};
|
||||
use sc_chain_spec::{Properties, ChainType};
|
||||
|
||||
/// Running node's static details.
|
||||
#[derive(Clone, Debug)]
|
||||
@@ -53,9 +53,7 @@ pub struct Health {
|
||||
|
||||
impl fmt::Display for Health {
|
||||
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
|
||||
write!(fmt, "{} peers ({})", self.peers, if self.is_syncing {
|
||||
"syncing"
|
||||
} else { "idle" })
|
||||
write!(fmt, "{} peers ({})", self.peers, if self.is_syncing { "syncing" } else { "idle" })
|
||||
}
|
||||
}
|
||||
|
||||
@@ -107,7 +105,8 @@ mod tests {
|
||||
peers: 1,
|
||||
is_syncing: false,
|
||||
should_have_peers: true,
|
||||
}).unwrap(),
|
||||
})
|
||||
.unwrap(),
|
||||
r#"{"peers":1,"isSyncing":false,"shouldHavePeers":true}"#,
|
||||
);
|
||||
}
|
||||
@@ -120,7 +119,8 @@ mod tests {
|
||||
roles: "a".into(),
|
||||
best_hash: 5u32,
|
||||
best_number: 6u32,
|
||||
}).unwrap(),
|
||||
})
|
||||
.unwrap(),
|
||||
r#"{"peerId":"2","roles":"a","bestHash":5,"bestNumber":6}"#,
|
||||
);
|
||||
}
|
||||
@@ -132,7 +132,8 @@ mod tests {
|
||||
starting_block: 12u32,
|
||||
current_block: 50u32,
|
||||
highest_block: Some(128u32),
|
||||
}).unwrap(),
|
||||
})
|
||||
.unwrap(),
|
||||
r#"{"startingBlock":12,"currentBlock":50,"highestBlock":128}"#,
|
||||
);
|
||||
|
||||
@@ -141,7 +142,8 @@ mod tests {
|
||||
starting_block: 12u32,
|
||||
current_block: 50u32,
|
||||
highest_block: None,
|
||||
}).unwrap(),
|
||||
})
|
||||
.unwrap(),
|
||||
r#"{"startingBlock":12,"currentBlock":50}"#,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -22,13 +22,15 @@ pub mod error;
|
||||
pub mod helpers;
|
||||
|
||||
use crate::helpers::Receiver;
|
||||
use futures::{compat::Compat, future::BoxFuture};
|
||||
use jsonrpc_derive::rpc;
|
||||
use futures::{future::BoxFuture, compat::Compat};
|
||||
|
||||
use self::error::Result as SystemResult;
|
||||
|
||||
pub use self::helpers::{SystemInfo, Health, PeerInfo, NodeRole, SyncState};
|
||||
pub use self::gen_client::Client as SystemClient;
|
||||
pub use self::{
|
||||
gen_client::Client as SystemClient,
|
||||
helpers::{Health, NodeRole, PeerInfo, SyncState, SystemInfo},
|
||||
};
|
||||
|
||||
/// Substrate system RPC API
|
||||
#[rpc]
|
||||
@@ -74,8 +76,9 @@ pub trait SystemApi<Hash, Number> {
|
||||
|
||||
/// Returns currently connected peers
|
||||
#[rpc(name = "system_peers", returns = "Vec<PeerInfo<Hash, Number>>")]
|
||||
fn system_peers(&self)
|
||||
-> Compat<BoxFuture<'static, jsonrpc_core::Result<Vec<PeerInfo<Hash, Number>>>>>;
|
||||
fn system_peers(
|
||||
&self,
|
||||
) -> Compat<BoxFuture<'static, jsonrpc_core::Result<Vec<PeerInfo<Hash, Number>>>>>;
|
||||
|
||||
/// Returns current state of the network.
|
||||
///
|
||||
@@ -84,8 +87,9 @@ pub trait SystemApi<Hash, Number> {
|
||||
// TODO: the future of this call is uncertain: https://github.com/paritytech/substrate/issues/1890
|
||||
// https://github.com/paritytech/substrate/issues/5541
|
||||
#[rpc(name = "system_unstable_networkState", returns = "jsonrpc_core::Value")]
|
||||
fn system_network_state(&self)
|
||||
-> Compat<BoxFuture<'static, jsonrpc_core::Result<jsonrpc_core::Value>>>;
|
||||
fn system_network_state(
|
||||
&self,
|
||||
) -> Compat<BoxFuture<'static, jsonrpc_core::Result<jsonrpc_core::Value>>>;
|
||||
|
||||
/// Adds a reserved peer. Returns the empty string or an error. The string
|
||||
/// parameter should encode a `p2p` multiaddr.
|
||||
@@ -93,14 +97,18 @@ pub trait SystemApi<Hash, Number> {
|
||||
/// `/ip4/198.51.100.19/tcp/30333/p2p/QmSk5HQbn6LhUwDiNMseVUjuRYhEtYj4aUZ6WfWoGURpdV`
|
||||
/// is an example of a valid, passing multiaddr with PeerId attached.
|
||||
#[rpc(name = "system_addReservedPeer", returns = "()")]
|
||||
fn system_add_reserved_peer(&self, peer: String)
|
||||
-> Compat<BoxFuture<'static, Result<(), jsonrpc_core::Error>>>;
|
||||
fn system_add_reserved_peer(
|
||||
&self,
|
||||
peer: String,
|
||||
) -> Compat<BoxFuture<'static, Result<(), jsonrpc_core::Error>>>;
|
||||
|
||||
/// Remove a reserved peer. Returns the empty string or an error. The string
|
||||
/// should encode only the PeerId e.g. `QmSk5HQbn6LhUwDiNMseVUjuRYhEtYj4aUZ6WfWoGURpdV`.
|
||||
#[rpc(name = "system_removeReservedPeer", returns = "()")]
|
||||
fn system_remove_reserved_peer(&self, peer_id: String)
|
||||
-> Compat<BoxFuture<'static, Result<(), jsonrpc_core::Error>>>;
|
||||
fn system_remove_reserved_peer(
|
||||
&self,
|
||||
peer_id: String,
|
||||
) -> Compat<BoxFuture<'static, Result<(), jsonrpc_core::Error>>>;
|
||||
|
||||
/// Returns the list of reserved peers
|
||||
#[rpc(name = "system_reservedPeers", returns = "Vec<String>")]
|
||||
@@ -121,11 +129,9 @@ pub trait SystemApi<Hash, Number> {
|
||||
///
|
||||
/// `sync=debug,state=trace`
|
||||
#[rpc(name = "system_addLogFilter", returns = "()")]
|
||||
fn system_add_log_filter(&self, directives: String)
|
||||
-> Result<(), jsonrpc_core::Error>;
|
||||
fn system_add_log_filter(&self, directives: String) -> Result<(), jsonrpc_core::Error>;
|
||||
|
||||
/// Resets the log filter to Substrate defaults
|
||||
#[rpc(name = "system_resetLogFilter", returns = "()")]
|
||||
fn system_reset_log_filter(&self)
|
||||
-> Result<(), jsonrpc_core::Error>;
|
||||
fn system_reset_log_filter(&self) -> Result<(), jsonrpc_core::Error>;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user