about summary refs log tree commit diff
diff options
context:
space:
mode:
authorKevin Per <kevin.per@protonmail.com>2020-04-04 08:39:17 +0000
committerKevin Per <kevin.per@protonmail.com>2020-04-04 08:39:17 +0000
commitf96b92f5097a31496b0b735a8647326c5dc2ecf8 (patch)
tree8ea964f3f5f1f85ff05d6901083f4d6de36f4771
parent2c6f84668e9f985aff261d317d3188d053ca29d1 (diff)
downloadrust-f96b92f5097a31496b0b735a8647326c5dc2ecf8.tar.gz
rust-f96b92f5097a31496b0b735a8647326c5dc2ecf8.zip
Run fmt
-rw-r--r--src/librustc_parse/lexer/tokentrees.rs47
1 files changed, 16 insertions, 31 deletions
diff --git a/src/librustc_parse/lexer/tokentrees.rs b/src/librustc_parse/lexer/tokentrees.rs
index 2dda90c3734..c08659ec9f6 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");