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