1
Fork 0

Prefer unwrap_or_else to unwrap_or in case of function calls/allocations

This commit is contained in:
ljedrz 2018-10-12 16:16:00 +02:00
parent cb5e1b93e3
commit d28aed6dc4
35 changed files with 57 additions and 54 deletions

View file

@ -128,7 +128,7 @@ impl<'a> DiagnosticBuilder<'a> {
message: &str,
span: Option<S>,
) -> &mut Self {
let span = span.map(|s| s.into()).unwrap_or(MultiSpan::new());
let span = span.map(|s| s.into()).unwrap_or_else(|| MultiSpan::new());
self.diagnostic.sub(level, message, span, None);
self
}