fix warnings with rust 1.25.0

This commit is contained in:
Daiderd Jordan 2018-04-12 22:32:30 +02:00
parent efdd718f08
commit 21751a4505
No known key found for this signature in database
GPG key ID: D02435D05B810C96

View file

@ -518,24 +518,27 @@ impl MetricCollector {
.map(|mtype| { .map(|mtype| {
let fields: Vec<String> = mtype.enum_field_names(); let fields: Vec<String> = mtype.enum_field_names();
let variant_match: String; let variant_match = if fields.len() > 0 {
if fields.len() > 0 { format!("{}({})", &mtype.variant(), fields.join(", "))
variant_match = format!("{}({})", &mtype.variant(), fields.join(", "));
} else { } else {
variant_match = format!("{}", &mtype.variant()); format!("{}", &mtype.variant())
};
let mut index_names: Vec<String> = mtype.enum_index_names();
index_names.push("instance".to_owned());
let mut index_fields = index_names.join(", ");
if index_names.len() > 1 {
index_fields = format!("({})", index_fields);
} }
let mut index_fields: Vec<String> = mtype.enum_index_names();
index_fields.push("instance".to_owned());
format!(" format!("
Event::{} => {{ Event::{} => {{
let mut accum_table = self.{} let mut accum_table = self.{}
.lock() .lock()
.expect(\"Failed to unwrap metric mutex for {}\"); .expect(\"Failed to unwrap metric mutex for {}\");
let accum = accum_table let accum = accum_table
.entry(({})) .entry({})
.or_insert(0); .or_insert(0);
*accum += {}; *accum += {};
}} }}
@ -543,7 +546,7 @@ impl MetricCollector {
variant_match, variant_match,
&mtype.metric_name(), &mtype.metric_name(),
&mtype.metric_name(), &mtype.metric_name(),
index_fields.join(", "), index_fields,
&mtype.record_value(), &mtype.record_value(),
) )
}).collect(); }).collect();