clippy
Signed-off-by: Frank Villaro-Dixon <frank@villaro-dixon.eu>
This commit is contained in:
parent
7ab7caa50e
commit
104de8e87e
2 changed files with 6 additions and 9 deletions
|
@ -44,7 +44,7 @@ impl Auth {
|
|||
let mut hasher = Sha256::new();
|
||||
hasher.update(token);
|
||||
let result = hasher.finalize();
|
||||
return format!("{:x}", result) == self.hash;
|
||||
format!("{:x}", result) == self.hash
|
||||
}
|
||||
_ => false,
|
||||
}
|
||||
|
@ -81,7 +81,7 @@ fn default_opentsdb_url() -> String {
|
|||
|
||||
pub fn load_config_file(filename: &str) -> Config {
|
||||
let yaml_content = fs::read_to_string(filename)
|
||||
.expect(format!("Unable to read config file {}", filename).as_str());
|
||||
.unwrap_or_else(|_| panic!("Unable to read config file {}", filename));
|
||||
let config: Config = serde_yaml::from_str(&yaml_content).expect("Unable to parse YAML");
|
||||
config
|
||||
}
|
||||
|
|
11
src/main.rs
11
src/main.rs
|
@ -1,7 +1,7 @@
|
|||
use actix_web::http::StatusCode;
|
||||
use actix_web::middleware::Logger;
|
||||
use actix_web::{error, web, App, HttpResponse, HttpServer, Responder};
|
||||
use log::{debug, error, info, log_enabled, Level};
|
||||
use actix_web::{web, App, HttpResponse, HttpServer, Responder};
|
||||
use log::{debug, error, info};
|
||||
use reqwest::Client;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::collections::HashMap;
|
||||
|
@ -64,7 +64,7 @@ async fn put_post(
|
|||
client.metrics.join(", ")
|
||||
);
|
||||
error!("{}", emsg);
|
||||
return HttpResponse::Forbidden().body(format!("{}", emsg));
|
||||
return HttpResponse::Forbidden().body(emsg.to_string());
|
||||
}
|
||||
|
||||
let post_url = format!("{}put", shared.cfg.config.opentsdb.url);
|
||||
|
@ -113,10 +113,7 @@ async fn main() -> std::io::Result<()> {
|
|||
|
||||
let web_client = Client::new();
|
||||
|
||||
let shared = ClientData {
|
||||
web_client: web_client,
|
||||
cfg: cfg,
|
||||
};
|
||||
let shared = ClientData { web_client, cfg };
|
||||
let client_data = web::Data::new(shared);
|
||||
|
||||
HttpServer::new(move || {
|
||||
|
|
Loading…
Reference in a new issue