diff options
Diffstat (limited to 'crates/mbe/src/expander')
-rw-r--r-- | crates/mbe/src/expander/matcher.rs | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/crates/mbe/src/expander/matcher.rs b/crates/mbe/src/expander/matcher.rs index 1bf7c2e81..b6782b4ba 100644 --- a/crates/mbe/src/expander/matcher.rs +++ b/crates/mbe/src/expander/matcher.rs | |||
@@ -540,7 +540,7 @@ fn match_loop(pattern: &MetaTemplate, src: &tt::Subtree) -> Match { | |||
540 | let mut src = TtIter::new(src); | 540 | let mut src = TtIter::new(src); |
541 | let mut stack: SmallVec<[TtIter; 1]> = SmallVec::new(); | 541 | let mut stack: SmallVec<[TtIter; 1]> = SmallVec::new(); |
542 | let mut res = Match::default(); | 542 | let mut res = Match::default(); |
543 | let mut error_reover_item = None; | 543 | let mut error_recover_item = None; |
544 | 544 | ||
545 | let mut bindings_builder = BindingsBuilder::default(); | 545 | let mut bindings_builder = BindingsBuilder::default(); |
546 | 546 | ||
@@ -579,9 +579,9 @@ fn match_loop(pattern: &MetaTemplate, src: &tt::Subtree) -> Match { | |||
579 | stdx::always!(cur_items.is_empty()); | 579 | stdx::always!(cur_items.is_empty()); |
580 | 580 | ||
581 | if error_items.len() > 0 { | 581 | if error_items.len() > 0 { |
582 | error_reover_item = error_items.pop().map(|it| it.bindings); | 582 | error_recover_item = error_items.pop().map(|it| it.bindings); |
583 | } else if eof_items.len() > 0 { | 583 | } else if eof_items.len() > 0 { |
584 | error_reover_item = Some(eof_items[0].bindings.clone()); | 584 | error_recover_item = Some(eof_items[0].bindings.clone()); |
585 | } | 585 | } |
586 | 586 | ||
587 | // We need to do some post processing after the `match_loop_inner`. | 587 | // We need to do some post processing after the `match_loop_inner`. |
@@ -594,8 +594,8 @@ fn match_loop(pattern: &MetaTemplate, src: &tt::Subtree) -> Match { | |||
594 | res.bindings = bindings_builder.build(&eof_items[0].bindings); | 594 | res.bindings = bindings_builder.build(&eof_items[0].bindings); |
595 | } else { | 595 | } else { |
596 | // Error recovery | 596 | // Error recovery |
597 | if error_reover_item.is_some() { | 597 | if let Some(item) = error_recover_item { |
598 | res.bindings = bindings_builder.build(&error_reover_item.unwrap()); | 598 | res.bindings = bindings_builder.build(&item); |
599 | } | 599 | } |
600 | res.add_err(ExpandError::UnexpectedToken); | 600 | res.add_err(ExpandError::UnexpectedToken); |
601 | } | 601 | } |
@@ -618,7 +618,7 @@ fn match_loop(pattern: &MetaTemplate, src: &tt::Subtree) -> Match { | |||
618 | } | 618 | } |
619 | res.add_err(err!("leftover tokens")); | 619 | res.add_err(err!("leftover tokens")); |
620 | 620 | ||
621 | if let Some(error_reover_item) = error_reover_item { | 621 | if let Some(error_reover_item) = error_recover_item { |
622 | res.bindings = bindings_builder.build(&error_reover_item); | 622 | res.bindings = bindings_builder.build(&error_reover_item); |
623 | } | 623 | } |
624 | return res; | 624 | return res; |