From aea4235c9ba6ec613fc1168d5d58995a6683f142 Mon Sep 17 00:00:00 2001 From: ConnorSkees <39542938+ConnorSkees@users.noreply.github.com> Date: Fri, 24 Apr 2020 20:13:22 -0400 Subject: [PATCH] simplify variable checks --- src/lib.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 9cc31f0..8000eb2 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -326,7 +326,7 @@ impl<'a> StyleSheetParser<'a> { } let VariableDecl { val, default, .. } = eat_variable_value(&mut self.lexer, &Scope::new(), &Selector::new())?; - if (default && !global_var_exists(&name)) || !default { + if !(default && global_var_exists(&name)) { insert_global_var(&name.node, val)?; } } @@ -635,7 +635,7 @@ pub(crate) fn eat_expr>( insert_global_var(&name.node, val.clone())?; } let var_exists = scope.var_exists(&name.node); - if (default && !var_exists) || !default { + if !(default && var_exists) { return Ok(Some(Spanned { node: Expr::VariableDecl(name.node, Box::new(val)), span,