Update deps and make clippy happy

This commit is contained in:
Frank Denis 2018-02-18 21:44:19 +01:00
parent 81db1ff07b
commit 25a3d524de
2 changed files with 341 additions and 246 deletions

569
Cargo.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -13,7 +13,7 @@ use std::str::FromStr;
use std::sync::{Arc, RwLock}; use std::sync::{Arc, RwLock};
use unicase::UniCase; use unicase::UniCase;
const TTL: u32 = 86400; const TTL: u32 = 86_400;
struct ASNsMiddleware { struct ASNsMiddleware {
asns_arc: Arc<RwLock<Arc<ASNs>>>, asns_arc: Arc<RwLock<Arc<ASNs>>>,
@ -82,7 +82,7 @@ impl WebService {
} }
fn output_json( fn output_json(
map: serde_json::Map<String, serde_json::value::Value>, map: &serde_json::Map<String, serde_json::value::Value>,
cache_header: Header<CacheControl>, cache_header: Header<CacheControl>,
vary_header: Header<Vary>, vary_header: Header<Vary>,
) -> IronResult<Response> { ) -> IronResult<Response> {
@ -102,7 +102,7 @@ impl WebService {
} }
fn output_html( fn output_html(
map: serde_json::Map<String, serde_json::value::Value>, map: &serde_json::Map<String, serde_json::value::Value>,
cache_header: Header<CacheControl>, cache_header: Header<CacheControl>,
vary_header: Header<Vary>, vary_header: Header<Vary>,
) -> IronResult<Response> { ) -> IronResult<Response> {
@ -130,7 +130,7 @@ impl WebService {
td { : format_args!("{}", if map.get("announced") td { : format_args!("{}", if map.get("announced")
.unwrap().as_bool().unwrap() { "Yes" } else { "No" }) } .unwrap().as_bool().unwrap() { "Yes" } else { "No" }) }
} }
@ if map.get("announced").unwrap().as_bool().unwrap() == true { @ if map.get("announced").unwrap().as_bool().unwrap() {
tr { tr {
th { : "First IP" } th { : "First IP" }
td { : format_args!("{}", map.get("first_ip") td { : format_args!("{}", map.get("first_ip")
@ -172,12 +172,12 @@ impl WebService {
} }
fn output( fn output(
output_type: OutputType, output_type: &OutputType,
map: serde_json::Map<String, serde_json::value::Value>, map: &serde_json::Map<String, serde_json::value::Value>,
cache_header: Header<CacheControl>, cache_header: Header<CacheControl>,
vary_header: Header<Vary>, vary_header: Header<Vary>,
) -> IronResult<Response> { ) -> IronResult<Response> {
match output_type { match *output_type {
OutputType::Json => Self::output_json(map, cache_header, vary_header), OutputType::Json => Self::output_json(map, cache_header, vary_header),
_ => Self::output_html(map, cache_header, vary_header), _ => Self::output_html(map, cache_header, vary_header),
} }
@ -232,7 +232,7 @@ impl WebService {
"announced".to_string(), "announced".to_string(),
serde_json::value::Value::Bool(false), serde_json::value::Value::Bool(false),
); );
return Self::output(Self::accept_type(&req), map, cache_header, vary_header); return Self::output(&Self::accept_type(req), &map, cache_header, vary_header);
} }
Some(found) => found, Some(found) => found,
}; };
@ -260,7 +260,7 @@ impl WebService {
"as_description".to_string(), "as_description".to_string(),
serde_json::value::Value::String(found.description.clone()), serde_json::value::Value::String(found.description.clone()),
); );
Self::output(Self::accept_type(&req), map, cache_header, vary_header) Self::output(&Self::accept_type(req), &map, cache_header, vary_header)
} }
pub fn start(asns_arc: Arc<RwLock<Arc<ASNs>>>, listen_addr: &str) { pub fn start(asns_arc: Arc<RwLock<Arc<ASNs>>>, listen_addr: &str) {