liniting fixes

master
Edward Shen 2019-11-09 17:25:42 -05:00
parent 2a56b0f4ad
commit 3224c02d6f
Signed by: edward
GPG Key ID: F350507060ED6C90
3 changed files with 7 additions and 5 deletions

View File

@ -35,7 +35,7 @@ fn main() {
let conf_file_loc =
var("ENDSTAT_CONF").unwrap_or_else(|_| String::from("./config/endstat_conf.ron"));
let config = from_str::<Config>(
&read_to_string(&conf_file_loc).expect(&format!("finding {}", conf_file_loc)),
&read_to_string(&conf_file_loc).unwrap_or_else(|_| panic!("finding {}", conf_file_loc)),
)
.unwrap();
let bind_addr = &config.bind_address;

View File

@ -50,7 +50,9 @@ impl QueryResults {
($(($hook:ident, $cond:expr)),*) => {
$(if let Some(url) = &webhooks.$hook {
if new_endpoint.status == $cond {
client.post(url).json(new_endpoint).send();
if let Err(e) = client.post(url).json(new_endpoint).send() {
warn!("{}", e)
}
}
})*
};

View File

@ -74,8 +74,8 @@ fn get_result(
if let Some(expected_hash) = &endpoint.body_hash {
let expected = from_hex(expected_hash).unwrap();
let actual = digest(&SHA256, String::from(res_body).as_bytes());
if &expected != &actual.as_ref() {
let actual = digest(&SHA256, res_body.as_bytes());
if expected != actual.as_ref() {
errors.push(String::from("Body hash mismatch."));
}
} else if !body.is_empty() && res_body != body {
@ -112,7 +112,7 @@ fn get_result(
}
}
fn get_url(base: &Option<String>, path: &String, port: Option<u16>) -> Result<String, UrlError> {
fn get_url(base: &Option<String>, path: &str, port: Option<u16>) -> Result<String, UrlError> {
let mut url = if let Some(base) = base {
Url::parse(base)?.join(path)?
} else {