Improved match statements
This commit is contained in:
@@ -450,7 +450,7 @@ loop_stmt = {
|
|||||||
pattern_list = { pattern ~ ("|" ~ pattern)* }
|
pattern_list = { pattern ~ ("|" ~ pattern)* }
|
||||||
|
|
||||||
match_item = {
|
match_item = {
|
||||||
pattern_list ~ "=>" ~ statement
|
pattern_list ~ "=>" ~ (statement | (expr ~ ","))
|
||||||
}
|
}
|
||||||
|
|
||||||
match_stmt = {
|
match_stmt = {
|
||||||
|
|||||||
@@ -109,8 +109,8 @@ pub void test_match_literal() {
|
|||||||
|
|
||||||
match x {
|
match x {
|
||||||
1 => { result = 10; }
|
1 => { result = 10; }
|
||||||
2 => { result = 20; }
|
2 => result = 20;
|
||||||
3 => { result = 30; }
|
3 => result = 30,
|
||||||
_ => panic!();
|
_ => panic!();
|
||||||
}
|
}
|
||||||
assert_eq!(result, 20);
|
assert_eq!(result, 20);
|
||||||
|
|||||||
Reference in New Issue
Block a user