Repository: rust-analyzer/rust-analyzer
Pull request #10451 (2021-10-04 13:18:02)

minor: Simplify
bors r+


Patch:
diff --git a/crates/ide_completion/src/completions/postfix.rs b/crates/ide_completion/src/completions/postfix.rs
index 7edd2e2876..55c49c2322 100644
--- a/crates/ide_completion/src/completions/postfix.rs
+++ b/crates/ide_completion/src/completions/postfix.rs
@@ -53,14 +53,14 @@ pub(crate) fn complete_postfix(acc: &mut Completions, ctx: &CompletionContext) {
         Some(it) => it,
         None => return,
     };
+
+    let postfix_snippet = build_postfix_snippet_builder(ctx, cap, &dot_receiver);
+
     let try_enum = TryEnum::from_ty(&ctx.sema, &receiver_ty.strip_references());
     if let Some(try_enum) = &try_enum {
         match try_enum {
             TryEnum::Result => {
                 postfix_snippet(
-                    ctx,
-                    cap,
-                    dot_receiver,
                     "ifl",
                     "if let Ok {}",
                     &format!("if let Ok($1) = {} {{\n    $0\n}}", receiver_text),
@@ -68,9 +68,6 @@ pub(crate) fn complete_postfix(acc: &mut Completions, ctx: &CompletionContext) {
                 .add_to(acc);
 
                 postfix_snippet(
-                    ctx,
-                    cap,
-                    dot_receiver,
                     "while",
                     "while let Ok {}",
                     &format!("while let Ok($1) = {} {{\n    $0\n}}", receiver_text),
@@ -79,9 +76,6 @@ pub(crate) fn complete_postfix(acc: &mut Completions, ctx: &CompletionContext) {
             }
             TryEnum::Option => {
                 postfix_snippet(
-                    ctx,
-                    cap,
-                    dot_receiver,
                     "ifl",
                     "if let Some {}",
                     &format!("if let Some($1) = {} {{\n    $0\n}}", receiver_text),
@@ -89,9 +83,6 @@ pub(crate) fn complete_postfix(acc: &mut Completions, ctx: &CompletionContext) {
                 .add_to(acc);
 
                 postfix_snippet(
-                    ctx,
-                    cap,
-                    dot_receiver,
                     "while",
                     "while let Some {}",
                     &format!("while let Some($1) = {} {{\n    $0\n}}", receiver_text),
@@ -100,32 +91,18 @@ pub(crate) fn complete_postfix(acc: &mut Completions, ctx: &CompletionContext) {
             }
         }
     } else if receiver_ty.is_bool() || receiver_ty.is_unknown() {
+        postfix_snippet("if", "if expr {}", &format!("if {} {{\n    $0\n}}", receiver_text))
+            .add_to(acc);
         postfix_snippet(
-            ctx,
-            cap,
-            dot_receiver,
-            "if",
-            "if expr {}",
-            &format!("if {} {{\n    $0\n}}", receiver_text),
-        )
-        .add_to(acc);
-        postfix_snippet(
-            ctx,
-            cap,
-            dot_receiver,
             "while",
             "while expr {}",
             &format!("while {} {{\n    $0\n}}", receiver_text),
         )
         .add_to(acc);
-        postfix_snippet(ctx, cap, dot_receiver, "not", "!expr", &format!("!{}", receiver_text))
-            .add_to(acc);
+        postfix_snippet("not", "!expr", &format!("!{}", receiver_text)).add_to(acc);
     } else if let Some(trait_) = FamousDefs(&ctx.sema, ctx.krate).core_iter_IntoIterator() {
         if receiver_ty.impls_trait(ctx.db, trait_, &[]) {
             postfix_snippet(
-                ctx,
-                cap,
-                dot_receiver,
                 "for",
                 "for ele in expr {}",
                 &format!("for ele in {} {{\n    $0\n}}", receiver_text),
@@ -134,30 +111,19 @@ pub(crate) fn complete_postfix(acc: &mut Completions, ctx: &CompletionContext) {
         }
     }
 
-    postfix_snippet(ctx, cap, dot_receiver, "ref", "&expr", &format!("&{}", receiver_text))
-        .add_to(acc);
-    postfix_snippet(
-        ctx,
-        cap,
-        dot_receiver,
-        "refm",
-        "&mut expr",
-        &format!("&mut {}", receiver_text),
-    )
-    .add_to(acc);
+    postfix_snippet("ref", "&expr", &format!("&{}", receiver_text)).add_to(acc);
+    postfix_snippet("refm", "&mut expr", &format!("&mut {}", receiver_text)).add_to(acc);
 
     // The rest of the postfix completions create an expression that moves an argument,
     // so it's better to consider references now to avoid breaking the compilation
     let dot_receiver = include_references(dot_receiver);
     let receiver_text = get_receiver_text(&dot_receiver, receiver_is_ambiguous_float_literal);
+    let postfix_snippet = build_postfix_snippet_builder(ctx, cap, &dot_receiver);
 
     match try_enum {
         Some(try_enum) => match try_enum {
             TryEnum::Result => {
                 postfix_snippet(
-                    ctx,
-                    cap,
-                    &dot_receiver,
                     "match",
                     "match expr {}",
                     &format!("match {} {{\n    Ok(${{1:_}}) => {{$2}},\n    Err(${{3:_}}) => {{$0}},\n}}", receiver_text),
@@ -166,9 +132,6 @@ pub(crate) fn complete_postfix(acc: &mut Completions, ctx: &CompletionContext) {
             }
             TryEnum::Option => {
                 postfix_snippet(
-                    ctx,
-                    cap,
-                    &dot_receiver,
                     "match",
                     "match expr {}",
                     &format!(
@@ -181,9 +144,6 @@ pub(crate) fn complete_postfix(acc: &mut Completions, ctx: &CompletionContext) {
         },
         None => {
             postfix_snippet(
-                ctx,
-                cap,
-                &dot_receiver,
                 "match",
                 "match expr {}",
                 &format!("match {} {{\n    ${{1:_}} => {{$0}},\n}}", receiver_text),
@@ -192,89 +152,19 @@ pub(crate) fn complete_postfix(acc: &mut Completions, ctx: &CompletionContext) {
         }
     }
 
-    postfix_snippet(
-        ctx,
-        cap,
-        &dot_receiver,
-        "box",
-        "Box::new(expr)",
-        &format!("Box::new({})", receiver_text),
-    )
-    .add_to(acc);
-
-    postfix_snippet(ctx, cap, &dot_receiver, "ok", "Ok(expr)", &format!("Ok({})", receiver_text))
-        .add_to(acc);
-
-    postfix_snippet(
-        ctx,
-        cap,
-        &dot_receiver,
-        "err",
-        "Err(expr)",
-        &format!("Err({})", receiver_text),
-    )
-    .add_to(acc);
-
-    postfix_snippet(
-        ctx,
-        cap,
-        &dot_receiver,
-        "some",
-        "Some(expr)",
-        &format!("Some({})", receiver_text),
-    )
-    .add_to(acc);
-
-    postfix_snippet(
-        ctx,
-        cap,
-        &dot_receiver,
-        "dbg",
-        "dbg!(expr)",
-        &format!("dbg!({})", receiver_text),
-    )
-    .add_to(acc);
-
-    postfix_snippet(
-        ctx,
-        cap,
-        &dot_receiver,
-        "dbgr",
-        "dbg!(&expr)",
-        &format!("dbg!(&{})", receiver_text),
-    )
-    .add_to(acc);
-
-    postfix_snippet(
-        ctx,
-        cap,
-        &dot_receiver,
-        "call",
-        "function(expr)",
-        &format!("${{1}}({})", receiver_text),
-    )
-    .add_to(acc);
+    postfix_snippet("box", "Box::new(expr)", &format!("Box::new({})", receiver_text)).add_to(acc);
+    postfix_snippet("ok", "Ok(expr)", &format!("Ok({})", receiver_text)).add_to(acc);
+    postfix_snippet("err", "Err(expr)", &format!("Err({})", receiver_text)).add_to(acc);
+    postfix_snippet("some", "Some(expr)", &format!("Some({})", receiver_text)).add_to(acc);
+    postfix_snippet("dbg", "dbg!(expr)", &format!("dbg!({})", receiver_text)).add_to(acc);
+    postfix_snippet("dbgr", "dbg!(&expr)", &format!("dbg!(&{})", receiver_text)).add_to(acc);
+    postfix_snippet("call", "function(expr)", &format!("${{1}}({})", receiver_text)).add_to(acc);
 
     if let Some(parent) = dot_receiver.syntax().parent().and_then(|p| p.parent()) {
         if matches!(parent.kind(), STMT_LIST | EXPR_STMT) {
-            postfix_snippet(
-                ctx,
-                cap,
-                &dot_receiver,
-                "let",
-                "let",
-                &format!("let $0 = {};", receiver_text),
-            )
-            .add_to(acc);
-            postfix_snippet(
-                ctx,
-                cap,
-                &dot_receiver,
-                "letm",
-                "let mut",
-                &format!("let mut $0 = {};", receiver_text),
-            )
-            .add_to(acc);
+            postfix_snippet("let", "let", &format!("let $0 = {};", receiver_text)).add_to(acc);
+            postfix_snippet("letm", "let mut", &format!("let mut $0 = {};", receiver_text))
+                .add_to(acc);
         }
     }
 
@@ -305,29 +195,27 @@ fn include_references(initial_element: &ast::Expr) -> ast::Expr {
     resulting_element
 }
 
-fn postfix_snippet(
-    ctx: &CompletionContext,
+fn build_postfix_snippet_builder<'a>(
+    ctx: &'a CompletionContext,
     cap: SnippetCap,
-    receiver: &ast::Expr,
-    label: &str,
-    detail: &str,
-    snippet: &str,
-) -> Builder {
-    let edit = {
-        let receiver_syntax = receiver.syntax();
-        let receiver_range = ctx.sema.original_range(receiver_syntax).range;
-        let delete_range = TextRange::new(receiver_range.start(), ctx.source_range().end());
-        TextEdit::replace(delete_range, snippet.to_string())
-    };
-    let mut item = CompletionItem::new(CompletionKind::Postfix, ctx.source_range(), label);
-    item.detail(detail).kind(CompletionItemKind::Snippet).snippet_edit(cap, edit);
-    if ctx.original_token.text() == label {
-        let relevance =
-            CompletionRelevance { exact_postfix_snippet_match: true, ..Default::default() };
-        item.set_relevance(relevance);
-    }
+    receiver: &'a ast::Expr,
+) -> impl Fn(&str, &str, &str) -> Builder + 'a {
+    let receiver_syntax = receiver.syntax();
+    let receiver_range = ctx.sema.original_range(receiver_syntax).range;
+    let delete_range = TextRange::new(receiver_range.start(), ctx.source_range().end());
+
+    move |label, detail, snippet| {
+        let edit = TextEdit::replace(delete_range, snippet.to_string());
+        let mut item = CompletionItem::new(CompletionKind::Postfix, ctx.source_range(), label);
+        item.detail(detail).kind(CompletionItemKind::Snippet).snippet_edit(cap, edit);
+        if ctx.original_token.text() == label {
+            let relevance =
+                CompletionRelevance { exact_postfix_snippet_match: true, ..Default::default() };
+            item.set_relevance(relevance);
+        }
 
-    item
+        item
+    }
 }
 
 #[cfg(test)]
diff --git a/crates/ide_completion/src/completions/postfix/format_like.rs b/crates/ide_completion/src/completions/postfix/format_like.rs
index d4061203c7..4fd8d038e7 100644
--- a/crates/ide_completion/src/completions/postfix/format_like.rs
+++ b/crates/ide_completion/src/completions/postfix/format_like.rs
@@ -19,7 +19,9 @@
 use ide_db::helpers::SnippetCap;
 use syntax::ast::{self, AstToken};
 
-use crate::{completions::postfix::postfix_snippet, context::CompletionContext, Completions};
+use crate::{
+    completions::postfix::build_postfix_snippet_builder, context::CompletionContext, Completions,
+};
 
 /// Mapping ("postfix completion item" => "macro to use")
 static KINDS: &[(&str, &str)] = &[
@@ -47,13 +49,14 @@ pub(crate) fn add_format_like_completions(
         None => return,
     };
 
+    let postfix_snippet = build_postfix_snippet_builder(ctx, cap, dot_receiver);
     let mut parser = FormatStrParser::new(input);
 
     if parser.parse().is_ok() {
         for (label, macro_name) in KINDS {
             let snippet = parser.to_suggestion(macro_name);
 
-            postfix_snippet(ctx, cap, dot_receiver, label, macro_name, &snippet).add_to(acc);
+            postfix_snippet(label, macro_name, &snippet).add_to(acc);
         }
     }
 }
diff --git a/crates/ide_diagnostics/src/handlers/unlinked_file.rs b/crates/ide_diagnostics/src/handlers/unlinked_file.rs
index cc10a63f87..5ea58b74fe 100644
--- a/crates/ide_diagnostics/src/handlers/unlinked_file.rs
+++ b/crates/ide_diagnostics/src/handlers/unlinked_file.rs
@@ -45,16 +45,14 @@ fn fixes(ctx: &DiagnosticsContext, file_id: FileId) -> Option<Vec<Assist>> {
     // - `$dir.rs` in the parent folder, where `$dir` is the directory containing `self.file_id`
     let parent = our_path.parent()?;
     let paths = {
-        let temp;
         let parent = if module_name == "mod" {
             // for mod.rs we need to actually look up one higher
             // and take the parent as our to be module name
             let (name, _) = parent.name_and_extension()?;
             module_name = name;
-            temp = parent.parent()?;
-            &temp
+            parent.parent()?
         } else {
-            &parent
+            parent
         };
         let mut paths =
             vec![parent.join("mod.rs")?, parent.join("lib.rs")?, parent.join("main.rs")?];
diff --git a/crates/parser/src/grammar/patterns.rs b/crates/parser/src/grammar/patterns.rs
index 60a7507c45..81e2051abb 100644
--- a/crates/parser/src/grammar/patterns.rs
+++ b/crates/parser/src/grammar/patterns.rs
@@ -69,11 +69,6 @@ fn pattern_single_r(p: &mut Parser, recovery_set: TokenSet) {
         //         200 .. 301 => (),
         //         302 .. => (),
         //     }
-        //
-        //     match Some(10 as u8) {
-        //         Some(0) | None => (),
-        //         Some(1..) => ()
-        //     }
         // }
 
         // FIXME: support half_open_range_patterns (`..=2`),
@@ -83,9 +78,9 @@ fn pattern_single_r(p: &mut Parser, recovery_set: TokenSet) {
                 let m = lhs.precede(p);
                 p.bump(range_op);
 
-                // `0 .. =>` or `let 0 .. =` or `Some(0 .. )`
-                //       ^                ^                ^
-                if p.at(T![=]) | p.at(T![')']) {
+                // `0 .. =>` or `let 0 .. =`
+                //       ^                ^
+                if p.at(T![=]) {
                     // test half_open_range_pat
                     // fn f() { let 0 .. = 1u32; }
                 } else {


Test patch:
diff --git a/crates/syntax/test_data/parser/inline/ok/0058_range_pat.rast b/crates/syntax/test_data/parser/inline/ok/0058_range_pat.rast
index 5d5803f751..1a8979db89 100644
--- a/crates/syntax/test_data/parser/inline/ok/0058_range_pat.rast
+++ b/crates/syntax/test_data/parser/inline/ok/0058_range_pat.rast
@@ -1,5 +1,5 @@
-SOURCE_FILE@0..223
-  FN@0..222
+SOURCE_FILE@0..135
+  FN@0..134
     FN_KW@0..2 "fn"
     WHITESPACE@2..3 " "
     NAME@3..7
@@ -8,168 +8,92 @@ SOURCE_FILE@0..223
       L_PAREN@7..8 "("
       R_PAREN@8..9 ")"
     WHITESPACE@9..10 " "
-    BLOCK_EXPR@10..222
-      STMT_LIST@10..222
+    BLOCK_EXPR@10..134
+      STMT_LIST@10..134
         L_CURLY@10..11 "{"
         WHITESPACE@11..16 "\n    "
-        EXPR_STMT@16..132
-          MATCH_EXPR@16..132
-            MATCH_KW@16..21 "match"
-            WHITESPACE@21..22 " "
-            LITERAL@22..24
-              INT_NUMBER@22..24 "92"
-            WHITESPACE@24..25 " "
-            MATCH_ARM_LIST@25..132
-              L_CURLY@25..26 "{"
-              WHITESPACE@26..35 "\n        "
-              MATCH_ARM@35..51
-                RANGE_PAT@35..44
-                  LITERAL_PAT@35..36
-                    LITERAL@35..36
-                      INT_NUMBER@35..36 "0"
-                  WHITESPACE@36..37 " "
-                  DOT3@37..40 "..."
-                  WHITESPACE@40..41 " "
-                  LITERAL_PAT@41..44
-                    LITERAL@41..44
-                      INT_NUMBER@41..44 "100"
-                WHITESPACE@44..45 " "
-                FAT_ARROW@45..47 "=>"
-                WHITESPACE@47..48 " "
-                TUPLE_EXPR@48..50
-                  L_PAREN@48..49 "("
-                  R_PAREN@49..50 ")"
-                COMMA@50..51 ","
-              WHITESPACE@51..60 "\n        "
-              MATCH_ARM@60..78
-                RANGE_PAT@60..71
-                  LITERAL_PAT@60..63
-                    LITERAL@60..63
-                      INT_NUMBER@60..63 "101"
-                  WHITESPACE@63..64 " "
-                  DOT2EQ@64..67 "..="
-                  WHITESPACE@67..68 " "
-                  LITERAL_PAT@68..71
-                    LITERAL@68..71
-                      INT_NUMBER@68..71 "200"
-                WHITESPACE@71..72 " "
-                FAT_ARROW@72..74 "=>"
-                WHITESPACE@74..75 " "
-                TUPLE_EXPR@75..77
-                  L_PAREN@75..76 "("
-                  R_PAREN@76..77 ")"
-                COMMA@77..78 ","
-              WHITESPACE@78..87 "\n        "
-              MATCH_ARM@87..104
-                RANGE_PAT@87..97
-                  LITERAL_PAT@87..90
-                    LITERAL@87..90
-                      INT_NUMBER@87..90 "200"
-                  WHITESPACE@90..91 " "
-                  DOT2@91..93 ".."
-                  WHITESPACE@93..94 " "
-                  LITERAL_PAT@94..97
-                    LITERAL@94..97
-                      INT_NUMBER@94..97 "301"
-                WHITESPACE@97..98 " "
-                FAT_ARROW@98..100 "=>"
-                WHITESPACE@100..101 " "
-                TUPLE_EXPR@101..103
-                  L_PAREN@101..102 "("
-                  R_PAREN@102..103 ")"
-                COMMA@103..104 ","
-              WHITESPACE@104..113 "\n        "
-              MATCH_ARM@113..126
-                RANGE_PAT@113..119
-                  LITERAL_PAT@113..116
-                    LITERAL@113..116
-                      INT_NUMBER@113..116 "302"
-                  WHITESPACE@116..117 " "
-                  DOT2@117..119 ".."
-                WHITESPACE@119..120 " "
-                FAT_ARROW@120..122 "=>"
-                WHITESPACE@122..123 " "
-                TUPLE_EXPR@123..125
-                  L_PAREN@123..124 "("
-                  R_PAREN@124..125 ")"
-                COMMA@125..126 ","
-              WHITESPACE@126..131 "\n    "
-              R_CURLY@131..132 "}"
-        WHITESPACE@132..138 "\n\n    "
-        MATCH_EXPR@138..220
-          MATCH_KW@138..143 "match"
-          WHITESPACE@143..144 " "
-          CALL_EXPR@144..158
-            PATH_EXPR@144..148
-              PATH@144..148
-                PATH_SEGMENT@144..148
-                  NAME_REF@144..148
-                    IDENT@144..148 "Some"
-            ARG_LIST@148..158
-              L_PAREN@148..149 "("
-              CAST_EXPR@149..157
-                LITERAL@149..151
-                  INT_NUMBER@149..151 "10"
-                WHITESPACE@151..152 " "
-                AS_KW@152..154 "as"
-                WHITESPACE@154..155 " "
-                PATH_TYPE@155..157
-                  PATH@155..157
-                    PATH_SEGMENT@155..157
-                      NAME_REF@155..157
-                        IDENT@155..157 "u8"
-              R_PAREN@157..158 ")"
-          WHITESPACE@158..159 " "
-          MATCH_ARM_LIST@159..220
-            L_CURLY@159..160 "{"
-            WHITESPACE@160..169 "\n        "
-            MATCH_ARM@169..190
-              OR_PAT@169..183
-                TUPLE_STRUCT_PAT@169..176
-                  PATH@169..173
-                    PATH_SEGMENT@169..173
-                      NAME_REF@169..173
-                        IDENT@169..173 "Some"
-                  L_PAREN@173..174 "("
-                  LITERAL_PAT@174..175
-                    LITERAL@174..175
-                      INT_NUMBER@174..175 "0"
-                  R_PAREN@175..176 ")"
-                WHITESPACE@176..177 " "
-                PIPE@177..178 "|"
-                WHITESPACE@178..179 " "
-                IDENT_PAT@179..183
-                  NAME@179..183
-                    IDENT@179..183 "None"
-              WHITESPACE@183..184 " "
-              FAT_ARROW@184..186 "=>"
-              WHITESPACE@186..187 " "
-              TUPLE_EXPR@187..189
-                L_PAREN@187..188 "("
-                R_PAREN@188..189 ")"
-              COMMA@189..190 ","
-            WHITESPACE@190..199 "\n        "
-            MATCH_ARM@199..214
-              TUPLE_STRUCT_PAT@199..208
-                PATH@199..203
-                  PATH_SEGMENT@199..203
-                    NAME_REF@199..203
-                      IDENT@199..203 "Some"
-                L_PAREN@203..204 "("
-                RANGE_PAT@204..207
-                  LITERAL_PAT@204..205
-                    LITERAL@204..205
-                      INT_NUMBER@204..205 "1"
-                  DOT2@205..207 ".."
-                R_PAREN@207..208 ")"
-              WHITESPACE@208..209 " "
-              FAT_ARROW@209..211 "=>"
-              WHITESPACE@211..212 " "
-              TUPLE_EXPR@212..214
-                L_PAREN@212..213 "("
-                R_PAREN@213..214 ")"
-            WHITESPACE@214..219 "\n    "
-            R_CURLY@219..220 "}"
-        WHITESPACE@220..221 "\n"
-        R_CURLY@221..222 "}"
-  WHITESPACE@222..223 "\n"
+        MATCH_EXPR@16..132
+          MATCH_KW@16..21 "match"
+          WHITESPACE@21..22 " "
+          LITERAL@22..24
+            INT_NUMBER@22..24 "92"
+          WHITESPACE@24..25 " "
+          MATCH_ARM_LIST@25..132
+            L_CURLY@25..26 "{"
+            WHITESPACE@26..35 "\n        "
+            MATCH_ARM@35..51
+              RANGE_PAT@35..44
+                LITERAL_PAT@35..36
+                  LITERAL@35..36
+                    INT_NUMBER@35..36 "0"
+                WHITESPACE@36..37 " "
+                DOT3@37..40 "..."
+                WHITESPACE@40..41 " "
+                LITERAL_PAT@41..44
+                  LITERAL@41..44
+                    INT_NUMBER@41..44 "100"
+              WHITESPACE@44..45 " "
+              FAT_ARROW@45..47 "=>"
+              WHITESPACE@47..48 " "
+              TUPLE_EXPR@48..50
+                L_PAREN@48..49 "("
+                R_PAREN@49..50 ")"
+              COMMA@50..51 ","
+            WHITESPACE@51..60 "\n        "
+            MATCH_ARM@60..78
+              RANGE_PAT@60..71
+                LITERAL_PAT@60..63
+                  LITERAL@60..63
+                    INT_NUMBER@60..63 "101"
+                WHITESPACE@63..64 " "
+                DOT2EQ@64..67 "..="
+                WHITESPACE@67..68 " "
+                LITERAL_PAT@68..71
+                  LITERAL@68..71
+                    INT_NUMBER@68..71 "200"
+              WHITESPACE@71..72 " "
+              FAT_ARROW@72..74 "=>"
+              WHITESPACE@74..75 " "
+              TUPLE_EXPR@75..77
+                L_PAREN@75..76 "("
+                R_PAREN@76..77 ")"
+              COMMA@77..78 ","
+            WHITESPACE@78..87 "\n        "
+            MATCH_ARM@87..104
+              RANGE_PAT@87..97
+                LITERAL_PAT@87..90
+                  LITERAL@87..90
+                    INT_NUMBER@87..90 "200"
+                WHITESPACE@90..91 " "
+                DOT2@91..93 ".."
+                WHITESPACE@93..94 " "
+                LITERAL_PAT@94..97
+                  LITERAL@94..97
+                    INT_NUMBER@94..97 "301"
+              WHITESPACE@97..98 " "
+              FAT_ARROW@98..100 "=>"
+              WHITESPACE@100..101 " "
+              TUPLE_EXPR@101..103
+                L_PAREN@101..102 "("
+                R_PAREN@102..103 ")"
+              COMMA@103..104 ","
+            WHITESPACE@104..113 "\n        "
+            MATCH_ARM@113..126
+              RANGE_PAT@113..119
+                LITERAL_PAT@113..116
+                  LITERAL@113..116
+                    INT_NUMBER@113..116 "302"
+                WHITESPACE@116..117 " "
+                DOT2@117..119 ".."
+              WHITESPACE@119..120 " "
+              FAT_ARROW@120..122 "=>"
+              WHITESPACE@122..123 " "
+              TUPLE_EXPR@123..125
+                L_PAREN@123..124 "("
+                R_PAREN@124..125 ")"
+              COMMA@125..126 ","
+            WHITESPACE@126..131 "\n    "
+            R_CURLY@131..132 "}"
+        WHITESPACE@132..133 "\n"
+        R_CURLY@133..134 "}"
+  WHITESPACE@134..135 "\n"
diff --git a/crates/syntax/test_data/parser/inline/ok/0058_range_pat.rs b/crates/syntax/test_data/parser/inline/ok/0058_range_pat.rs
index fa91efd212..3833fbd8d5 100644
--- a/crates/syntax/test_data/parser/inline/ok/0058_range_pat.rs
+++ b/crates/syntax/test_data/parser/inline/ok/0058_range_pat.rs
@@ -5,9 +5,4 @@ fn main() {
         200 .. 301 => (),
         302 .. => (),
     }
-
-    match Some(10 as u8) {
-        Some(0) | None => (),
-        Some(1..) => ()
-    }
 }