From c0c8de6eb9fe7310fb459fc892d0806bfaa2ce5e Mon Sep 17 00:00:00 2001 From: Connor Skees Date: Sun, 23 Aug 2020 20:09:53 -0400 Subject: [PATCH] simplify media query `==` comparison check --- src/parse/media.rs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/parse/media.rs b/src/parse/media.rs index 45e3865..3a4eafd 100644 --- a/src/parse/media.rs +++ b/src/parse/media.rs @@ -34,13 +34,13 @@ impl<'a> Parser<'a> { | Some(Token { kind: ':', .. }) | Some(Token { kind: ')', .. }) => true, Some(Token { kind: '=', .. }) => { - if matches!(toks.peek_next(), Some(Token { kind: '=', .. })) { - toks.reset_cursor(); - false - } else { - toks.reset_cursor(); - true - } + let is_double_eq = matches!(toks.peek_next(), Some(Token { kind: '=', .. })); + toks.reset_cursor(); + // if it is a double eq, then parse as normal + // + // otherwise, it is a single eq and we should + // treat it as a comparison + !is_double_eq } _ => false, })?;