Use unwrap_or_else() for the default value in the DateTime Display impl

This commit is contained in:
Sebastian Dröge 2017-12-05 23:20:10 +02:00
parent 05c51dd778
commit ad7b21ba55

View file

@ -13,7 +13,7 @@ impl fmt::Display for DateTime {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
f.write_str(
self.to_iso8601_string()
.unwrap_or(String::from("None"))
.unwrap_or_else(|| String::from("None"))
.as_str(),
)
}