Prefer unwrap_or_else to unwrap_or in case of function calls/allocations
This commit is contained in:
parent
cb5e1b93e3
commit
d28aed6dc4
35 changed files with 57 additions and 54 deletions
|
@ -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
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue