Modify stack-based matcher to use while let
Getty Ritter
9 years ago
14 | 14 | * we'll short-circuit out of this loop; otherwise, an empty |
15 | 15 | * stack means we have failed every possible branch and can |
16 | 16 | * return false. */ |
17 | while stack.len() > 0 { | |
18 | /* This call to .unwrap() is safe because we've already | |
19 | * manually checked the stack length. */ | |
20 | let st = stack.pop().unwrap(); | |
17 | while let Some(st) = stack.pop() { | |
21 | 18 | match instrs[st.pc] { |
22 | 19 | Instr::Char(_) if st.cc >= input.len() => |
23 | 20 | continue, |