File tree Expand file tree Collapse file tree 2 files changed +26
-11
lines changed
ide-diagnostics/src/handlers Expand file tree Collapse file tree 2 files changed +26
-11
lines changed Original file line number Diff line number Diff line change @@ -1914,17 +1914,20 @@ impl DefWithBody {
1914
1914
if let ast:: Expr :: MatchExpr ( match_expr) =
1915
1915
& source_ptr. value . to_node ( & root)
1916
1916
{
1917
- if let Some ( scrut_expr) = match_expr. expr ( ) {
1918
- acc. push (
1919
- MissingMatchArms {
1920
- scrutinee_expr : InFile :: new (
1921
- source_ptr. file_id ,
1922
- AstPtr :: new ( & scrut_expr) ,
1923
- ) ,
1924
- uncovered_patterns,
1925
- }
1926
- . into ( ) ,
1927
- ) ;
1917
+ match match_expr. expr ( ) {
1918
+ Some ( scrut_expr) if match_expr. match_arm_list ( ) . is_some ( ) => {
1919
+ acc. push (
1920
+ MissingMatchArms {
1921
+ scrutinee_expr : InFile :: new (
1922
+ source_ptr. file_id ,
1923
+ AstPtr :: new ( & scrut_expr) ,
1924
+ ) ,
1925
+ uncovered_patterns,
1926
+ }
1927
+ . into ( ) ,
1928
+ ) ;
1929
+ }
1930
+ _ => { }
1928
1931
}
1929
1932
}
1930
1933
}
Original file line number Diff line number Diff line change @@ -25,6 +25,18 @@ mod tests {
25
25
crate :: tests:: check_diagnostics ( ra_fixture)
26
26
}
27
27
28
+ #[ test]
29
+ fn empty_body ( ) {
30
+ check_diagnostics_no_bails (
31
+ r#"
32
+ fn main() {
33
+ match 0;
34
+ //^ error: Syntax Error: expected `{`
35
+ }
36
+ "# ,
37
+ ) ;
38
+ }
39
+
28
40
#[ test]
29
41
fn empty_tuple ( ) {
30
42
check_diagnostics_no_bails (
You can’t perform that action at this time.
0 commit comments