From 05ae391e2cd1cd356e5db437f79ce1b6137dfa64 Mon Sep 17 00:00:00 2001 From: HMPerson1 Date: Thu, 25 Oct 2018 21:16:46 -0400 Subject: [PATCH] Workaround rust-lang/rust#43081 --- clippy_lints/src/formatting.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/clippy_lints/src/formatting.rs b/clippy_lints/src/formatting.rs index 1fae0974d95..cc3801423c8 100644 --- a/clippy_lints/src/formatting.rs +++ b/clippy_lints/src/formatting.rs @@ -156,6 +156,11 @@ fn check_else(cx: &EarlyContext<'_>, expr: &ast::Expr) { && !differing_macro_contexts(then.span, else_.span) && !in_macro(then.span) { + // workaround for rust-lang/rust#43081 + if expr.span.lo().0 == 0 && expr.span.hi().0 == 0 { + return; + } + // this will be a span from the closing ‘}’ of the “then” block (excluding) to // the // “if” of the “else if” block (excluding)