Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.
Closed
Prev Previous commit
Next Next commit
Remove &self and Result for default_ methods
  • Loading branch information
cecton committed Jun 4, 2020
commit c7f985129b956c29ccb1a7bbd6f4e81195f5ef13
18 changes: 0 additions & 18 deletions client/cli/src/commands/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -292,25 +292,13 @@ macro_rules! substrate_cli_subcommands {
}
}

fn default_rpc_http_port(&self) -> $crate::Result<u16> {
match self {
$($enum::$variant(cmd) => cmd.default_rpc_http_port()),*
}
}

fn rpc_ws(&self, default_port: u16)
-> $crate::Result<::std::option::Option<::std::net::SocketAddr>> {
match self {
$($enum::$variant(cmd) => cmd.rpc_ws(default_port)),*
}
}

fn default_rpc_ws_port(&self) -> $crate::Result<u16> {
match self {
$($enum::$variant(cmd) => cmd.default_rpc_ws_port()),*
}
}

fn rpc_methods(&self) -> $crate::Result<sc_service::config::RpcMethods> {
match self {
$($enum::$variant(cmd) => cmd.rpc_methods()),*
Expand All @@ -337,12 +325,6 @@ macro_rules! substrate_cli_subcommands {
}
}

fn default_prometheus_port(&self) -> $crate::Result<u16> {
match self {
$($enum::$variant(cmd) => cmd.default_prometheus_port()),*
}
}

fn telemetry_endpoints(
&self,
chain_spec: &Box<dyn ::sc_service::ChainSpec>,
Expand Down
18 changes: 9 additions & 9 deletions client/cli/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -262,8 +262,8 @@ pub trait CliConfiguration: Sized {
/// Get the default RPC HTTP port.
///
/// By default this is 9933.
fn default_rpc_http_port(&self) -> Result<u16> {
Ok(9933)
fn default_rpc_http_port() -> u16 {
9933
}

/// Get the RPC websocket address (`None` if disabled).
Expand All @@ -276,8 +276,8 @@ pub trait CliConfiguration: Sized {
/// Get the default RPC websocket port.
///
/// By default this is 9944.
fn default_rpc_ws_port(&self) -> Result<u16> {
Ok(9944)
fn default_rpc_ws_port() -> u16 {
9944
}

/// Returns the RPC method set to expose.
Expand Down Expand Up @@ -312,8 +312,8 @@ pub trait CliConfiguration: Sized {
/// Get the default prometheus port
///
/// By default this 9615.
fn default_prometheus_port(&self) -> Result<u16> {
Ok(9615)
fn default_prometheus_port() -> u16 {
9615
}

/// Get the telemetry endpoints (if any)
Expand Down Expand Up @@ -466,12 +466,12 @@ pub trait CliConfiguration: Sized {
pruning: self.pruning(unsafe_pruning, &role)?,
wasm_method: self.wasm_method()?,
execution_strategies: self.execution_strategies(is_dev)?,
rpc_http: self.rpc_http(self.default_rpc_http_port()?)?,
rpc_ws: self.rpc_ws(self.default_rpc_ws_port()?)?,
rpc_http: self.rpc_http(Self::default_rpc_http_port())?,
rpc_ws: self.rpc_ws(Self::default_rpc_ws_port())?,
rpc_methods: self.rpc_methods()?,
rpc_ws_max_connections: self.rpc_ws_max_connections()?,
rpc_cors: self.rpc_cors(is_dev)?,
prometheus_config: self.prometheus_config(self.default_prometheus_port()?)?,
prometheus_config: self.prometheus_config(Self::default_prometheus_port())?,
telemetry_endpoints: self.telemetry_endpoints(&chain_spec)?,
telemetry_external_transport: self.telemetry_external_transport()?,
default_heap_pages: self.default_heap_pages()?,
Expand Down