Commit 6105cb1
bors-servo
Auto merge of servo#189 - tromey:remove-confusing-dead-code, r=SimonSapin
Clarify some dead code
next_token has this code:
if is_ident_start(tokenizer) { IDHash(consume_name(tokenizer)) }
else if !tokenizer.is_eof() && match tokenizer.next_byte_unchecked() {
b'a'...b'z' | b'A'...b'Z' | b'0'...b'9' | b'-' | b'_' => true,
b'\\' => !tokenizer.has_newline_at(1),
_ => !b.is_ascii(),
} { Hash(consume_name(tokenizer)) }
I noticed that the `_` case incorrectly checks whether `b` is ASCII,
rather than the current byte.
However, on further inspection, it turns out that this can't be run,
because all such cases would have been filtered out by is_ident_start.
This patch clarifies this code by removing the dead cases and adding a
comment.
<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/rust-cssparser/189)
<!-- Reviewable:end -->1 file changed
+3
-3
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
493 | 493 | | |
494 | 494 | | |
495 | 495 | | |
496 | | - | |
497 | | - | |
498 | | - | |
| 496 | + | |
| 497 | + | |
| 498 | + | |
499 | 499 | | |
500 | 500 | | |
501 | 501 | | |
| |||
0 commit comments