about summary refs log tree commit diff
path: root/compiler/rustc_parse/src/parser
diff options
context:
space:
mode:
authorTakayuki Maeda <takoyaki0316@gmail.com>2022-09-26 23:13:09 +0900
committerTakayuki Maeda <takoyaki0316@gmail.com>2022-09-27 10:22:46 +0900
commite123a612977145e6ea47bd85307d13cfa52455d5 (patch)
treef6e7741b1868d8543b7a0e7169978f7f0009bec1 /compiler/rustc_parse/src/parser
parent8b705839cd656d202e920efa8769cbe43a5ee269 (diff)
downloadrust-e123a612977145e6ea47bd85307d13cfa52455d5.tar.gz
rust-e123a612977145e6ea47bd85307d13cfa52455d5.zip
create a new local var
Diffstat (limited to 'compiler/rustc_parse/src/parser')
-rw-r--r--compiler/rustc_parse/src/parser/item.rs8
1 files changed, 3 insertions, 5 deletions
diff --git a/compiler/rustc_parse/src/parser/item.rs b/compiler/rustc_parse/src/parser/item.rs
index 34f25bd0716..297efd8dd46 100644
--- a/compiler/rustc_parse/src/parser/item.rs
+++ b/compiler/rustc_parse/src/parser/item.rs
@@ -1291,12 +1291,10 @@ impl<'a> Parser<'a> {
     /// Parses an enum declaration.
     fn parse_item_enum(&mut self) -> PResult<'a, ItemInfo> {
         if self.token.is_keyword(kw::Struct) {
-            let mut err = self.struct_span_err(
-                self.prev_token.span.to(self.token.span),
-                "`enum` and `struct` are mutually exclusive",
-            );
+            let span = self.prev_token.span.to(self.token.span);
+            let mut err = self.struct_span_err(span, "`enum` and `struct` are mutually exclusive");
             err.span_suggestion(
-                self.prev_token.span.to(self.token.span),
+                span,
                 "replace `enum struct` with",
                 "enum",
                 Applicability::MachineApplicable,