fixes for nightly clippy (#1618)

This commit is contained in:
Svyatoslav Nikolsky
2022-10-28 11:46:40 +03:00
committed by Bastian Köcher
parent 9592b55fea
commit f58e076ca2
22 changed files with 45 additions and 45 deletions
+4 -4
View File
@@ -68,7 +68,7 @@ pub fn initialize_logger(with_timestamp: bool) {
let log_level = color_level(record.level());
let log_target = color_target(record.target());
writeln!(buf, "{}{} {} {}", loop_name_prefix(), log_level, log_target, record.args(),)
writeln!(buf, "{}{log_level} {log_target} {}", loop_name_prefix(), record.args(),)
});
}
@@ -92,7 +92,7 @@ fn loop_name_prefix() -> String {
if loop_name.is_empty() {
String::new()
} else {
format!("[{}] ", loop_name)
format!("[{loop_name}] ")
}
})
.unwrap_or_else(|_| String::new())
@@ -105,8 +105,8 @@ enum Either<A, B> {
impl<A: Display, B: Display> Display for Either<A, B> {
fn fmt(&self, fmt: &mut std::fmt::Formatter) -> std::fmt::Result {
match self {
Self::Left(a) => write!(fmt, "{}", a),
Self::Right(b) => write!(fmt, "{}", b),
Self::Left(a) => write!(fmt, "{a}"),
Self::Right(b) => write!(fmt, "{b}"),
}
}
}
+2 -2
View File
@@ -189,12 +189,12 @@ pub fn format_ids<Id: std::fmt::Debug>(mut ids: impl ExactSizeIterator<Item = Id
2 => {
let id0 = ids.next().expect(NTH_PROOF);
let id1 = ids.next().expect(NTH_PROOF);
format!("[{:?}, {:?}]", id0, id1)
format!("[{id0:?}, {id1:?}]")
},
len => {
let id0 = ids.next().expect(NTH_PROOF);
let id_last = ids.last().expect(NTH_PROOF);
format!("{}:[{:?} ... {:?}]", len, id0, id_last)
format!("{len}:[{id0:?} ... {id_last:?}]")
},
}
}
+1 -1
View File
@@ -121,7 +121,7 @@ impl From<Option<MetricsAddress>> for MetricsParams {
/// Returns metric name optionally prefixed with given prefix.
pub fn metric_name(prefix: Option<&str>, name: &str) -> String {
if let Some(prefix) = prefix {
format!("{}_{}", prefix, name)
format!("{prefix}_{name}")
} else {
name.into()
}