remove unwrap in unknown at rule parsing

This commit is contained in:
ConnorSkees 2020-05-24 12:52:38 -04:00
parent 3051cec45a
commit c9e5bc89c4
2 changed files with 7 additions and 2 deletions

View File

@ -41,14 +41,14 @@ impl UnknownAtRule {
match tok.kind { match tok.kind {
'{' => break, '{' => break,
'#' => { '#' => {
if toks.peek().unwrap().kind == '{' { if let Some(Token { kind: '{', .. }) = toks.peek() {
toks.next(); toks.next();
let interpolation = parse_interpolation(toks, scope, super_selector)?; let interpolation = parse_interpolation(toks, scope, super_selector)?;
params.push_str(&interpolation.node.to_css_string(interpolation.span)?); params.push_str(&interpolation.node.to_css_string(interpolation.span)?);
continue;
} else { } else {
params.push(tok.kind); params.push(tok.kind);
} }
continue;
} }
'\n' | ' ' | '\t' => { '\n' | ' ' | '\t' => {
devour_whitespace(toks); devour_whitespace(toks);

View File

@ -15,3 +15,8 @@ test!(
"@#{()if(0,0<0,0)}", "@#{()if(0,0<0,0)}",
"@false;\n" "@false;\n"
); );
test!(
nothing_after_hash,
"@foo #",
"@foo #;\n"
);