From 39f6aa27f4a94b5f09de78165df5494e6032f936 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Esteban=20K=C3=BCber?= Date: Mon, 6 Nov 2023 23:48:58 +0000 Subject: [PATCH] Fix tidy --- compiler/rustc_parse/src/parser/expr.rs | 1 + .../recover-parens-around-match-arm-head.fixed | 12 ++++++++++++ .../recover/recover-parens-around-match-arm-head.rs | 3 ++- .../recover-parens-around-match-arm-head.stderr | 4 ++-- 4 files changed, 17 insertions(+), 3 deletions(-) create mode 100644 tests/ui/parser/recover/recover-parens-around-match-arm-head.fixed diff --git a/compiler/rustc_parse/src/parser/expr.rs b/compiler/rustc_parse/src/parser/expr.rs index 7af88e32aec0d..2cd7208b1d9dd 100644 --- a/compiler/rustc_parse/src/parser/expr.rs +++ b/compiler/rustc_parse/src/parser/expr.rs @@ -1,3 +1,4 @@ +// ignore-tidy-filelength use super::diagnostics::SnapshotParser; use super::pat::{CommaRecoveryMode, Expected, RecoverColon, RecoverComma}; use super::ty::{AllowPlus, RecoverQPath, RecoverReturnSign}; diff --git a/tests/ui/parser/recover/recover-parens-around-match-arm-head.fixed b/tests/ui/parser/recover/recover-parens-around-match-arm-head.fixed new file mode 100644 index 0000000000000..6b9b7fa882a07 --- /dev/null +++ b/tests/ui/parser/recover/recover-parens-around-match-arm-head.fixed @@ -0,0 +1,12 @@ +// run-rustfix +fn main() { + let val = 42; + let x = match val { + 0 if true => { + //~^ ERROR unexpected parentheses surrounding `match` arm pattern + 42u8 + } + _ => 0u8, + }; + let _y: u32 = x.into(); //~ ERROR mismatched types +} diff --git a/tests/ui/parser/recover/recover-parens-around-match-arm-head.rs b/tests/ui/parser/recover/recover-parens-around-match-arm-head.rs index 20d27c256563b..f523581e2da19 100644 --- a/tests/ui/parser/recover/recover-parens-around-match-arm-head.rs +++ b/tests/ui/parser/recover/recover-parens-around-match-arm-head.rs @@ -1,3 +1,4 @@ +// run-rustfix fn main() { let val = 42; let x = match val { @@ -8,4 +9,4 @@ fn main() { _ => 0u8, }; let _y: u32 = x; //~ ERROR mismatched types -} \ No newline at end of file +} diff --git a/tests/ui/parser/recover/recover-parens-around-match-arm-head.stderr b/tests/ui/parser/recover/recover-parens-around-match-arm-head.stderr index 0d1143fbc99f4..bad4d7d2f19f5 100644 --- a/tests/ui/parser/recover/recover-parens-around-match-arm-head.stderr +++ b/tests/ui/parser/recover/recover-parens-around-match-arm-head.stderr @@ -1,5 +1,5 @@ error: unexpected parentheses surrounding `match` arm pattern - --> $DIR/recover-parens-around-match-arm-head.rs:4:9 + --> $DIR/recover-parens-around-match-arm-head.rs:5:9 | LL | (0 if true) => { | ^ ^ @@ -11,7 +11,7 @@ LL + 0 if true => { | error[E0308]: mismatched types - --> $DIR/recover-parens-around-match-arm-head.rs:10:19 + --> $DIR/recover-parens-around-match-arm-head.rs:11:19 | LL | let _y: u32 = x; | --- ^ expected `u32`, found `u8`