remove unwrap in favor of if let

This commit is contained in:
ConnorSkees 2020-05-23 14:03:47 -04:00
parent da768badea
commit 34f9436163
2 changed files with 5 additions and 1 deletions

View File

@ -839,7 +839,7 @@ impl Value {
} }
q @ '>' | q @ '<' => { q @ '>' | q @ '<' => {
let mut span = toks.next().unwrap().pos(); let mut span = toks.next().unwrap().pos();
IntermediateValue::Op(if toks.peek().unwrap().kind == '=' { IntermediateValue::Op(if let Some(Token { kind: '=', ..}) = toks.peek() {
span = span.merge(toks.next().unwrap().pos()); span = span.merge(toks.next().unwrap().pos());
match q { match q {
'>' => Op::GreaterThanEqual, '>' => Op::GreaterThanEqual,

View File

@ -172,3 +172,7 @@ error!(
ends_with_single_eq, ends_with_single_eq,
"a {color: 1 =", "Error: expected \"=\"." "a {color: 1 =", "Error: expected \"=\"."
); );
error!(
nothing_after_gt,
"a {color: 1 >", "Error: Expected expression."
);