Skip to content

Commit

Permalink
Optimize a statement in parsing of any-value production in the `sel…
Browse files Browse the repository at this point in the history
…ectors` module

There's no need for the `<=` operator since `count` guarantees values are never negative.
  • Loading branch information
amn committed Sep 29, 2024
1 parent c3cdd33 commit 2f5275e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/csspring/selectors.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def parse_any_value(input: TokenStream) -> Product | None:
case OpenParenToken() | OpenBracketToken() | OpenBraceToken():
count[type(token)] += 1
case CloseParenToken() | CloseBracketToken() | CloseBraceToken():
if count[token.mirror_type] <= 0:
if count[token.mirror_type] == 0:
break
count[token.mirror_type] -= 1
case None:
Expand Down

0 comments on commit 2f5275e

Please sign in to comment.