From f96b92f5097a31496b0b735a8647326c5dc2ecf8 Mon Sep 17 00:00:00 2001 From: Kevin Per Date: Sat, 4 Apr 2020 08:39:17 +0000 Subject: [PATCH] Run fmt --- src/librustc_parse/lexer/tokentrees.rs | 47 +++++++++----------------- 1 file changed, 16 insertions(+), 31 deletions(-) diff --git a/src/librustc_parse/lexer/tokentrees.rs b/src/librustc_parse/lexer/tokentrees.rs index 2dda90c37343..c08659ec9f64 100644 --- a/src/librustc_parse/lexer/tokentrees.rs +++ b/src/librustc_parse/lexer/tokentrees.rs @@ -1,6 +1,6 @@ use super::{StringReader, UnmatchedBrace}; -use rustc_ast::token::{self, Token, DelimToken}; +use rustc_ast::token::{self, DelimToken, Token}; use rustc_ast::tokenstream::{ DelimSpan, IsJoint::{self, *}, @@ -238,40 +238,25 @@ impl<'a> TokenTreesReader<'a> { let mut err = self.string_reader.sess.span_diagnostic.struct_span_err(self.token.span, &msg); - // Braces are added at the end, so the last element is the biggest block - if let Some(parent) = self.matching_block_spans.last() { - - if let Some(span) = self.last_delim_empty_block_spans.remove(&delim) { - // Check if the (empty block) is in the last properly closed block - if (parent.0.to(parent.1)).contains(span) { - err.span_label( - span, - "block is empty, you might have not meant to close it", - ); - } - else { - err.span_label( - parent.0, - "this opening brace...", - ); - - err.span_label( - parent.1, - "...matches this closing brace", - ); - } - } - else { + // Braces are added at the end, so the last element is the biggest block + if let Some(parent) = self.matching_block_spans.last() { + if let Some(span) = self.last_delim_empty_block_spans.remove(&delim) { + // Check if the (empty block) is in the last properly closed block + if (parent.0.to(parent.1)).contains(span) { err.span_label( - parent.0, - "this opening brace...", + span, + "block is empty, you might have not meant to close it", ); + } else { + err.span_label(parent.0, "this opening brace..."); - err.span_label( - parent.1, - "...matches this closing brace", - ); + err.span_label(parent.1, "...matches this closing brace"); } + } else { + err.span_label(parent.0, "this opening brace..."); + + err.span_label(parent.1, "...matches this closing brace"); + } } err.span_label(self.token.span, "unexpected closing delimiter");