Appease Clippy

This commit is contained in:
David Palm
2021-03-25 12:07:54 +01:00
parent 8f5f2102f9
commit 1d2183df24
6 changed files with 20 additions and 24 deletions
+9 -8
View File
@@ -20,10 +20,10 @@ use node::connector::NodeConnector;
use types::NodeId;
use util::{Locator, LocatorFactory};
const VERSION: &'static str = env!("CARGO_PKG_VERSION");
const AUTHORS: &'static str = env!("CARGO_PKG_AUTHORS");
const NAME: &'static str = "Substrate Telemetry Backend";
const ABOUT: &'static str = "This is the Telemetry Backend that injects and provide the data sent by Substrate/Polkadot nodes";
const VERSION: &str = env!("CARGO_PKG_VERSION");
const AUTHORS: &str = env!("CARGO_PKG_AUTHORS");
const NAME: &str = "Substrate Telemetry Backend";
const ABOUT: &str = "This is the Telemetry Backend that injects and provide the data sent by Substrate/Polkadot nodes";
#[derive(Clap)]
#[clap(name = NAME, version = VERSION, author = AUTHORS, about = ABOUT)]
@@ -54,9 +54,9 @@ enum LogLevel {
Trace,
}
impl Into<log::LevelFilter> for &LogLevel {
fn into(self) -> log::LevelFilter {
match self {
impl From<&LogLevel> for log::LevelFilter {
fn from(log_level: &LogLevel) -> Self {
match log_level {
LogLevel::Error => log::LevelFilter::Error,
LogLevel::Warn => log::LevelFilter::Warn,
LogLevel::Info => log::LevelFilter::Info,
@@ -65,6 +65,7 @@ impl Into<log::LevelFilter> for &LogLevel {
}
}
}
/// Entry point for connecting nodes
#[get("/submit/")]
async fn node_route(
@@ -74,7 +75,7 @@ async fn node_route(
locator: web::Data<Addr<Locator>>,
) -> Result<HttpResponse, Error> {
let ip = req.connection_info().realip_remote_addr().and_then(|mut addr| {
if let Some(port_idx) = addr.find(":") {
if let Some(port_idx) = addr.find(':') {
addr = &addr[..port_idx];
}
addr.parse::<Ipv4Addr>().ok()