From d28aed6dc45ffccc790469cb04f3f775ddb2283a Mon Sep 17 00:00:00 2001 From: ljedrz Date: Fri, 12 Oct 2018 16:16:00 +0200 Subject: Prefer unwrap_or_else to unwrap_or in case of function calls/allocations --- src/librustc_errors/diagnostic_builder.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/librustc_errors') diff --git a/src/librustc_errors/diagnostic_builder.rs b/src/librustc_errors/diagnostic_builder.rs index 60a68b1e496..f4289ea2d4b 100644 --- a/src/librustc_errors/diagnostic_builder.rs +++ b/src/librustc_errors/diagnostic_builder.rs @@ -128,7 +128,7 @@ impl<'a> DiagnosticBuilder<'a> { message: &str, span: Option, ) -> &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 } -- cgit 1.4.1-3-g733a5