clippy
This commit is contained in:
parent
b631ad78bc
commit
150ba14b74
@ -71,7 +71,7 @@ impl CallArgs {
|
||||
|
||||
if self.is_empty() {
|
||||
return Ok(Spanned {
|
||||
node: "()".to_string(),
|
||||
node: "()".to_owned(),
|
||||
span,
|
||||
});
|
||||
}
|
||||
@ -181,9 +181,9 @@ impl CallArgs {
|
||||
err.push_str(&len.to_string());
|
||||
err.push(' ');
|
||||
if len == 1 {
|
||||
err.push_str("was passed.")
|
||||
err.push_str("was passed.");
|
||||
} else {
|
||||
err.push_str("were passed.")
|
||||
err.push_str("were passed.");
|
||||
}
|
||||
return Err((err, self.span()).into());
|
||||
}
|
||||
|
@ -14,7 +14,7 @@ pub(crate) struct Function {
|
||||
|
||||
impl Hash for Function {
|
||||
fn hash<H: Hasher>(&self, state: &mut H) {
|
||||
self.pos.hash(state)
|
||||
self.pos.hash(state);
|
||||
}
|
||||
}
|
||||
|
||||
@ -31,8 +31,8 @@ impl Function {
|
||||
Function {
|
||||
args,
|
||||
body,
|
||||
pos,
|
||||
declared_at_root,
|
||||
pos,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -100,7 +100,7 @@ impl TryFrom<&Spanned<String>> for AtRuleKind {
|
||||
|
||||
Ok(match unvendor(&c.node) {
|
||||
"keyframes" => Self::Keyframes,
|
||||
_ => Self::Unknown(c.node.to_owned()),
|
||||
_ => Self::Unknown(c.node.clone()),
|
||||
})
|
||||
}
|
||||
}
|
||||
|
@ -75,7 +75,7 @@ pub(crate) fn selector_nest(args: CallArgs, parser: &mut Parser<'_>) -> SassResu
|
||||
.try_fold(
|
||||
Selector::new(span),
|
||||
|parent, child| -> SassResult<Selector> {
|
||||
Ok(child.resolve_parent_selectors(&parent, true)?)
|
||||
child.resolve_parent_selectors(&parent, true)
|
||||
},
|
||||
)?
|
||||
.into_value())
|
||||
@ -97,7 +97,7 @@ pub(crate) fn selector_append(args: CallArgs, parser: &mut Parser<'_>) -> SassRe
|
||||
Ok(parsed_selectors
|
||||
.into_iter()
|
||||
.try_fold(first, |parent, child| -> SassResult<Selector> {
|
||||
Ok(Selector(SelectorList {
|
||||
Selector(SelectorList {
|
||||
components: child
|
||||
.0
|
||||
.components
|
||||
@ -127,7 +127,7 @@ pub(crate) fn selector_append(args: CallArgs, parser: &mut Parser<'_>) -> SassRe
|
||||
.collect::<SassResult<Vec<ComplexSelector>>>()?,
|
||||
span,
|
||||
})
|
||||
.resolve_parent_selectors(&parent, false)?)
|
||||
.resolve_parent_selectors(&parent, false)
|
||||
})?
|
||||
.into_value())
|
||||
}
|
||||
|
@ -279,7 +279,7 @@ pub(crate) fn str_insert(mut args: CallArgs, parser: &mut Parser<'_>) -> SassRes
|
||||
if i + 1 == idx {
|
||||
c.to_string() + s2
|
||||
} else if idx == 0 && i == 0 {
|
||||
s2.to_string() + &c.to_string()
|
||||
s2.to_owned() + &c.to_string()
|
||||
} else {
|
||||
c.to_string()
|
||||
}
|
||||
|
@ -533,7 +533,7 @@ fn repr(red: &Number, green: &Number, blue: &Number, alpha: &Number) -> String {
|
||||
if alpha < &Number::one() {
|
||||
format!("rgba({}, {}, {}, {})", red_u8, green_u8, blue_u8, alpha)
|
||||
} else if let Some(c) = NAMED_COLORS.get_by_rgba([red_u8, green_u8, blue_u8]) {
|
||||
(*c).to_string()
|
||||
(*c).to_owned()
|
||||
} else {
|
||||
format!("#{:0>2x}{:0>2x}{:0>2x}", red_u8, green_u8, blue_u8)
|
||||
}
|
||||
|
@ -15,7 +15,7 @@ impl InternedString {
|
||||
|
||||
#[allow(dead_code)]
|
||||
pub fn resolve(self) -> String {
|
||||
STRINGS.with(|interner| interner.borrow().resolve(&self.0).to_string())
|
||||
STRINGS.with(|interner| interner.borrow().resolve(&self.0).to_owned())
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
|
@ -33,7 +33,7 @@ impl<'a> Iterator for Lexer<'a> {
|
||||
.span
|
||||
.subspan(self.pos as u64, (self.pos + len) as u64);
|
||||
self.pos += len;
|
||||
Some(Token { kind, pos })
|
||||
Some(Token { pos, kind })
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -58,6 +58,8 @@ grass input.scss
|
||||
clippy::panic_in_result_fn,
|
||||
clippy::unwrap_in_result,
|
||||
clippy::map_err_ignore,
|
||||
clippy::default_numeric_fallback,
|
||||
clippy::if_then_some_else_none,
|
||||
|
||||
// temporarily allowed while under heavy development.
|
||||
// eventually these allows should be refactored away
|
||||
|
@ -68,7 +68,7 @@ impl Toplevel {
|
||||
if let Toplevel::RuleSet(_, entries) | Toplevel::KeyframesRuleSet(_, entries) = self {
|
||||
entries.push(BlockEntry::Style(s));
|
||||
} else {
|
||||
panic!()
|
||||
panic!();
|
||||
}
|
||||
}
|
||||
|
||||
@ -76,7 +76,7 @@ impl Toplevel {
|
||||
if let Toplevel::RuleSet(_, entries) | Toplevel::KeyframesRuleSet(_, entries) = self {
|
||||
entries.push(BlockEntry::MultilineComment(s));
|
||||
} else {
|
||||
panic!()
|
||||
panic!();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -125,28 +125,28 @@ impl Css {
|
||||
Stmt::Comment(s) => vals.first_mut().unwrap().push_comment(s),
|
||||
Stmt::Media(m) => {
|
||||
let MediaRule { query, body, .. } = *m;
|
||||
vals.push(Toplevel::Media { query, body })
|
||||
vals.push(Toplevel::Media { query, body });
|
||||
}
|
||||
Stmt::Supports(s) => {
|
||||
let SupportsRule { params, body } = *s;
|
||||
vals.push(Toplevel::Supports { params, body })
|
||||
vals.push(Toplevel::Supports { params, body });
|
||||
}
|
||||
Stmt::UnknownAtRule(u) => {
|
||||
let UnknownAtRule {
|
||||
params, body, name, ..
|
||||
} = *u;
|
||||
vals.push(Toplevel::UnknownAtRule(Box::new(ToplevelUnknownAtRule {
|
||||
name,
|
||||
params,
|
||||
body,
|
||||
name,
|
||||
})))
|
||||
})));
|
||||
}
|
||||
Stmt::Return(..) => unreachable!(),
|
||||
Stmt::AtRoot { body } => {
|
||||
body.into_iter().try_for_each(|r| -> SassResult<()> {
|
||||
vals.append(&mut self.parse_stmt(r)?);
|
||||
Ok(())
|
||||
})?
|
||||
})?;
|
||||
}
|
||||
Stmt::Keyframes(k) => {
|
||||
let Keyframes { rule, name, body } = *k;
|
||||
@ -154,10 +154,10 @@ impl Css {
|
||||
rule,
|
||||
name,
|
||||
body,
|
||||
})))
|
||||
})));
|
||||
}
|
||||
k @ Stmt::KeyframesRuleSet(..) => {
|
||||
unreachable!("@keyframes ruleset {:?}", k)
|
||||
unreachable!("@keyframes ruleset {:?}", k);
|
||||
}
|
||||
Stmt::Import(s) => self.plain_imports.push(Toplevel::Import(s)),
|
||||
};
|
||||
@ -183,8 +183,8 @@ impl Css {
|
||||
params, body, name, ..
|
||||
} = *u;
|
||||
vec![Toplevel::UnknownAtRule(Box::new(ToplevelUnknownAtRule {
|
||||
params,
|
||||
name,
|
||||
params,
|
||||
body,
|
||||
}))]
|
||||
}
|
||||
@ -316,10 +316,10 @@ impl Css {
|
||||
if body.is_empty() {
|
||||
writeln!(buf, ";")?;
|
||||
continue;
|
||||
} else {
|
||||
writeln!(buf, " {{")?;
|
||||
}
|
||||
|
||||
writeln!(buf, " {{")?;
|
||||
|
||||
Css::from_stmts(body, true, self.allows_charset)?._inner_pretty_print(
|
||||
buf,
|
||||
map,
|
||||
@ -343,10 +343,10 @@ impl Css {
|
||||
if body.is_empty() {
|
||||
writeln!(buf, " {{}}")?;
|
||||
continue;
|
||||
} else {
|
||||
writeln!(buf, " {{")?;
|
||||
}
|
||||
|
||||
writeln!(buf, " {{")?;
|
||||
|
||||
Css::from_stmts(body, true, self.allows_charset)?._inner_pretty_print(
|
||||
buf,
|
||||
map,
|
||||
@ -369,10 +369,10 @@ impl Css {
|
||||
if body.is_empty() {
|
||||
writeln!(buf, ";")?;
|
||||
continue;
|
||||
} else {
|
||||
writeln!(buf, " {{")?;
|
||||
}
|
||||
|
||||
writeln!(buf, " {{")?;
|
||||
|
||||
Css::from_stmts(body, true, self.allows_charset)?._inner_pretty_print(
|
||||
buf,
|
||||
map,
|
||||
|
@ -188,22 +188,16 @@ impl<'a> Parser<'a> {
|
||||
let value = self.parse_value(true, &|c| match c.peek() {
|
||||
Some(Token { kind: ')', .. }) | Some(Token { kind: ',', .. }) => true,
|
||||
Some(Token { kind: '.', .. }) => {
|
||||
if matches!(c.peek_next(), Some(Token { kind: '.', .. })) {
|
||||
c.reset_cursor();
|
||||
true
|
||||
} else {
|
||||
c.reset_cursor();
|
||||
false
|
||||
}
|
||||
let next_is_dot = matches!(c.peek_next(), Some(Token { kind: '.', .. }));
|
||||
c.reset_cursor();
|
||||
|
||||
next_is_dot
|
||||
}
|
||||
Some(Token { kind: '=', .. }) => {
|
||||
if matches!(c.peek_next(), Some(Token { kind: '=', .. })) {
|
||||
c.reset_cursor();
|
||||
false
|
||||
} else {
|
||||
c.reset_cursor();
|
||||
true
|
||||
}
|
||||
let next_is_eq = matches!(c.peek_next(), Some(Token { kind: '=', .. }));
|
||||
c.reset_cursor();
|
||||
|
||||
!next_is_eq
|
||||
}
|
||||
Some(..) | None => false,
|
||||
});
|
||||
@ -297,13 +291,11 @@ impl<'a> Parser<'a> {
|
||||
let right = self.parse_value(true, &|c| match c.peek() {
|
||||
Some(Token { kind: ')', .. }) | Some(Token { kind: ',', .. }) => true,
|
||||
Some(Token { kind: '.', .. }) => {
|
||||
if matches!(c.peek_next(), Some(Token { kind: '.', .. })) {
|
||||
c.reset_cursor();
|
||||
true
|
||||
} else {
|
||||
c.reset_cursor();
|
||||
false
|
||||
}
|
||||
let next_is_dot =
|
||||
matches!(c.peek_next(), Some(Token { kind: '.', .. }));
|
||||
c.reset_cursor();
|
||||
|
||||
next_is_dot
|
||||
}
|
||||
Some(..) | None => false,
|
||||
})?;
|
||||
|
@ -23,7 +23,7 @@ impl<T> NeverEmptyVec<T> {
|
||||
}
|
||||
|
||||
pub fn push(&mut self, value: T) {
|
||||
self.rest.push(value)
|
||||
self.rest.push(value);
|
||||
}
|
||||
|
||||
pub fn pop(&mut self) -> Option<T> {
|
||||
|
@ -122,30 +122,30 @@ impl<'a> Parser<'a> {
|
||||
if found_true {
|
||||
self.throw_away_until_closing_curly_brace()?;
|
||||
break;
|
||||
} else {
|
||||
self.scopes.enter_new_scope();
|
||||
let tmp = Parser {
|
||||
toks: self.toks,
|
||||
map: self.map,
|
||||
path: self.path,
|
||||
scopes: self.scopes,
|
||||
global_scope: self.global_scope,
|
||||
super_selectors: self.super_selectors,
|
||||
span_before: self.span_before,
|
||||
content: self.content,
|
||||
flags: self.flags | ContextFlags::IN_CONTROL_FLOW,
|
||||
at_root: self.at_root,
|
||||
at_root_has_selector: self.at_root_has_selector,
|
||||
extender: self.extender,
|
||||
content_scopes: self.content_scopes,
|
||||
options: self.options,
|
||||
modules: self.modules,
|
||||
module_config: self.module_config,
|
||||
}
|
||||
.parse_stmt();
|
||||
self.scopes.exit_scope();
|
||||
return tmp;
|
||||
}
|
||||
|
||||
self.scopes.enter_new_scope();
|
||||
let tmp = Parser {
|
||||
toks: self.toks,
|
||||
map: self.map,
|
||||
path: self.path,
|
||||
scopes: self.scopes,
|
||||
global_scope: self.global_scope,
|
||||
super_selectors: self.super_selectors,
|
||||
span_before: self.span_before,
|
||||
content: self.content,
|
||||
flags: self.flags | ContextFlags::IN_CONTROL_FLOW,
|
||||
at_root: self.at_root,
|
||||
at_root_has_selector: self.at_root_has_selector,
|
||||
extender: self.extender,
|
||||
content_scopes: self.content_scopes,
|
||||
options: self.options,
|
||||
modules: self.modules,
|
||||
module_config: self.module_config,
|
||||
}
|
||||
.parse_stmt();
|
||||
self.scopes.exit_scope();
|
||||
return tmp;
|
||||
}
|
||||
_ => {
|
||||
return Err(("expected \"{\".", tok.pos()).into());
|
||||
|
@ -272,10 +272,10 @@ impl<'a> Parser<'a> {
|
||||
v => s.push_str(v.to_css_string(interpolation.span)?.borrow()),
|
||||
};
|
||||
continue;
|
||||
} else {
|
||||
s.push('#');
|
||||
continue;
|
||||
}
|
||||
|
||||
s.push('#');
|
||||
continue;
|
||||
}
|
||||
'\n' => return Err(("Expected \".", tok.pos()).into()),
|
||||
'\\' => {
|
||||
|
@ -13,15 +13,18 @@ use crate::{
|
||||
|
||||
use super::{Parser, Stmt};
|
||||
|
||||
#[allow(clippy::case_sensitive_file_extension_comparisons)]
|
||||
fn is_plain_css_import(url: &str) -> bool {
|
||||
if url.len() < 5 {
|
||||
return false;
|
||||
}
|
||||
|
||||
url.ends_with(".css")
|
||||
|| url.starts_with("http://")
|
||||
|| url.starts_with("https://")
|
||||
|| url.starts_with("//")
|
||||
let lower = url.to_ascii_lowercase();
|
||||
|
||||
lower.ends_with(".css")
|
||||
|| lower.starts_with("http://")
|
||||
|| lower.starts_with("https://")
|
||||
|| lower.starts_with("//")
|
||||
}
|
||||
|
||||
impl<'a> Parser<'a> {
|
||||
@ -55,7 +58,7 @@ impl<'a> Parser<'a> {
|
||||
|
||||
for name in &paths {
|
||||
if name.is_file() {
|
||||
return Some(name.to_path_buf());
|
||||
return Some(name.clone());
|
||||
}
|
||||
}
|
||||
|
||||
@ -165,10 +168,12 @@ impl<'a> Parser<'a> {
|
||||
let mut list_of_imports: Vec<Stmt> = Vec::new();
|
||||
for file_name_element in v {
|
||||
match file_name_element {
|
||||
#[allow(clippy::case_sensitive_file_extension_comparisons)]
|
||||
Value::String(s, QuoteKind::Quoted) => {
|
||||
if s.ends_with(".css")
|
||||
|| s.starts_with("http://")
|
||||
|| s.starts_with("https://")
|
||||
let lower = s.to_ascii_lowercase();
|
||||
if lower.ends_with(".css")
|
||||
|| lower.starts_with("http://")
|
||||
|| lower.starts_with("https://")
|
||||
{
|
||||
list_of_imports.push(Stmt::Import(format!("\"{}\"", s)));
|
||||
} else {
|
||||
|
@ -40,7 +40,7 @@ impl<'a, 'b> KeyframesSelectorParser<'a, 'b> {
|
||||
let mut ident = self.parser.parse_identifier()?;
|
||||
ident.node.make_ascii_lowercase();
|
||||
if ident.node == "to" {
|
||||
selectors.push(KeyframesSelector::To)
|
||||
selectors.push(KeyframesSelector::To);
|
||||
} else {
|
||||
return Err(("Expected \"to\" or \"from\".", tok.pos).into());
|
||||
}
|
||||
@ -49,7 +49,7 @@ impl<'a, 'b> KeyframesSelectorParser<'a, 'b> {
|
||||
let mut ident = self.parser.parse_identifier()?;
|
||||
ident.node.make_ascii_lowercase();
|
||||
if ident.node == "from" {
|
||||
selectors.push(KeyframesSelector::From)
|
||||
selectors.push(KeyframesSelector::From);
|
||||
} else {
|
||||
return Err(("Expected \"to\" or \"from\".", tok.pos).into());
|
||||
}
|
||||
@ -104,7 +104,7 @@ impl<'a> Parser<'a> {
|
||||
'{' => {
|
||||
// todo: we can avoid the reallocation by trimming before emitting
|
||||
// (in `output.rs`)
|
||||
return Ok(name.trim().to_string());
|
||||
return Ok(name.trim().to_owned());
|
||||
}
|
||||
_ => name.push(tok.kind),
|
||||
}
|
||||
|
@ -92,22 +92,22 @@ impl<'a> Parser<'a> {
|
||||
self.whitespace_or_comment();
|
||||
buf.push(')');
|
||||
return Ok(buf);
|
||||
} else {
|
||||
let next_tok = self.toks.peek().cloned();
|
||||
let is_angle = next_tok.map_or(false, |t| t.kind == '<' || t.kind == '>');
|
||||
if is_angle || matches!(next_tok, Some(Token { kind: '=', .. })) {
|
||||
buf.push(' ');
|
||||
// todo: remove this unwrap
|
||||
buf.push(self.toks.next().unwrap().kind);
|
||||
if is_angle && self.consume_char_if_exists('=') {
|
||||
buf.push('=');
|
||||
}
|
||||
buf.push(' ');
|
||||
}
|
||||
|
||||
self.whitespace_or_comment();
|
||||
|
||||
buf.push_str(&self.expression_until_comparison()?);
|
||||
let next_tok = self.toks.peek().cloned();
|
||||
let is_angle = next_tok.map_or(false, |t| t.kind == '<' || t.kind == '>');
|
||||
if is_angle || matches!(next_tok, Some(Token { kind: '=', .. })) {
|
||||
buf.push(' ');
|
||||
// todo: remove this unwrap
|
||||
buf.push(self.toks.next().unwrap().kind);
|
||||
if is_angle && self.consume_char_if_exists('=') {
|
||||
buf.push('=');
|
||||
}
|
||||
buf.push(' ');
|
||||
|
||||
self.whitespace_or_comment();
|
||||
|
||||
buf.push_str(&self.expression_until_comparison()?);
|
||||
}
|
||||
|
||||
self.expect_char(')')?;
|
||||
|
@ -165,13 +165,11 @@ impl<'a> Parser<'a> {
|
||||
AtRuleKind::Return => {
|
||||
if self.flags.in_function() {
|
||||
return Ok(vec![Stmt::Return(self.parse_return()?)]);
|
||||
} else {
|
||||
return Err((
|
||||
"This at-rule is not allowed here.",
|
||||
kind_string.span,
|
||||
)
|
||||
.into());
|
||||
}
|
||||
|
||||
return Err(
|
||||
("This at-rule is not allowed here.", kind_string.span).into()
|
||||
);
|
||||
}
|
||||
AtRuleKind::AtRoot => {
|
||||
if self.flags.in_function() {
|
||||
@ -215,7 +213,7 @@ impl<'a> Parser<'a> {
|
||||
self.warn(&Spanned {
|
||||
node: message.to_css_string(span)?,
|
||||
span,
|
||||
})
|
||||
});
|
||||
}
|
||||
AtRuleKind::Debug => {
|
||||
let Spanned {
|
||||
@ -230,7 +228,7 @@ impl<'a> Parser<'a> {
|
||||
self.debug(&Spanned {
|
||||
node: message.inspect(span)?,
|
||||
span,
|
||||
})
|
||||
});
|
||||
}
|
||||
AtRuleKind::If => stmts.append(&mut self.parse_if()?),
|
||||
AtRuleKind::Each => stmts.append(&mut self.parse_each()?),
|
||||
@ -253,7 +251,7 @@ impl<'a> Parser<'a> {
|
||||
}
|
||||
AtRuleKind::Media => stmts.push(self.parse_media()?),
|
||||
AtRuleKind::Unknown(_) => {
|
||||
stmts.push(self.parse_unknown_at_rule(kind_string.node)?)
|
||||
stmts.push(self.parse_unknown_at_rule(kind_string.node)?);
|
||||
}
|
||||
AtRuleKind::Use => {
|
||||
return Err((
|
||||
@ -266,7 +264,7 @@ impl<'a> Parser<'a> {
|
||||
AtRuleKind::Extend => self.parse_extend()?,
|
||||
AtRuleKind::Supports => stmts.push(self.parse_supports()?),
|
||||
AtRuleKind::Keyframes => {
|
||||
stmts.push(self.parse_keyframes(kind_string.node)?)
|
||||
stmts.push(self.parse_keyframes(kind_string.node)?);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -308,7 +306,7 @@ impl<'a> Parser<'a> {
|
||||
if self.flags.in_keyframes() {
|
||||
match self.is_selector_or_style()? {
|
||||
SelectorOrStyle::ModuleVariableRedeclaration(module) => {
|
||||
self.parse_module_variable_redeclaration(module)?
|
||||
self.parse_module_variable_redeclaration(module)?;
|
||||
}
|
||||
SelectorOrStyle::Style(property, value) => {
|
||||
if let Some(value) = value {
|
||||
@ -338,7 +336,7 @@ impl<'a> Parser<'a> {
|
||||
|
||||
match self.is_selector_or_style()? {
|
||||
SelectorOrStyle::ModuleVariableRedeclaration(module) => {
|
||||
self.parse_module_variable_redeclaration(module)?
|
||||
self.parse_module_variable_redeclaration(module)?;
|
||||
}
|
||||
SelectorOrStyle::Style(property, value) => {
|
||||
if let Some(value) = value {
|
||||
@ -422,10 +420,10 @@ impl<'a> Parser<'a> {
|
||||
'{' => {
|
||||
if from_fn {
|
||||
return Err(("Expected selector.", pos).into());
|
||||
} else {
|
||||
found_curly = true;
|
||||
break;
|
||||
}
|
||||
|
||||
found_curly = true;
|
||||
break;
|
||||
}
|
||||
'\\' => {
|
||||
string.push('\\');
|
||||
@ -835,7 +833,7 @@ impl<'a> Parser<'a> {
|
||||
&extend_rule,
|
||||
&None,
|
||||
self.span_before,
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
Ok(())
|
||||
@ -893,9 +891,9 @@ impl<'a> Parser<'a> {
|
||||
let interpolation = self.parse_interpolation()?;
|
||||
params.push_str(&interpolation.node.to_css_string(interpolation.span)?);
|
||||
continue;
|
||||
} else {
|
||||
params.push(tok.kind);
|
||||
}
|
||||
|
||||
params.push(tok.kind);
|
||||
}
|
||||
'\n' | ' ' | '\t' => {
|
||||
self.whitespace();
|
||||
|
@ -32,11 +32,11 @@ impl<'a> Parser<'a> {
|
||||
if let Some(Token { kind: '*', .. }) = self.toks.peek() {
|
||||
self.toks.next();
|
||||
return Ok(Some('*'.to_string()));
|
||||
} else {
|
||||
let name = self.parse_identifier_no_interpolation(false)?;
|
||||
|
||||
return Ok(Some(name.node));
|
||||
}
|
||||
|
||||
let name = self.parse_identifier_no_interpolation(false)?;
|
||||
|
||||
return Ok(Some(name.node));
|
||||
}
|
||||
|
||||
Ok(None)
|
||||
|
@ -37,11 +37,11 @@ impl<'a> Parser<'a> {
|
||||
toks.push(*tok);
|
||||
self.toks.peek_forward(1);
|
||||
break;
|
||||
} else {
|
||||
scope -= 1;
|
||||
toks.push(*tok);
|
||||
self.toks.peek_forward(1);
|
||||
}
|
||||
|
||||
scope -= 1;
|
||||
toks.push(*tok);
|
||||
self.toks.peek_forward(1);
|
||||
}
|
||||
'(' => {
|
||||
toks.push(*tok);
|
||||
@ -154,12 +154,12 @@ impl<'a> Parser<'a> {
|
||||
return Ok(SelectorOrStyle::ModuleVariableRedeclaration(
|
||||
property.into(),
|
||||
));
|
||||
} else {
|
||||
if whitespace_after_property {
|
||||
property.push(' ');
|
||||
}
|
||||
return Ok(SelectorOrStyle::Selector(property));
|
||||
}
|
||||
|
||||
if whitespace_after_property {
|
||||
property.push(' ');
|
||||
}
|
||||
return Ok(SelectorOrStyle::Selector(property));
|
||||
}
|
||||
_ => {
|
||||
if whitespace_after_property {
|
||||
@ -219,9 +219,9 @@ impl<'a> Parser<'a> {
|
||||
self.toks.next();
|
||||
self.whitespace();
|
||||
return Ok(styles);
|
||||
} else {
|
||||
continue;
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
@ -78,9 +78,9 @@ impl<'a> Parser<'a> {
|
||||
'}' => {
|
||||
if nesting == 0 {
|
||||
return Ok(());
|
||||
} else {
|
||||
nesting -= 1;
|
||||
}
|
||||
|
||||
nesting -= 1;
|
||||
}
|
||||
'/' => match self.toks.peek() {
|
||||
Some(Token { kind: '/', .. }) => {
|
||||
@ -107,9 +107,9 @@ impl<'a> Parser<'a> {
|
||||
')' => {
|
||||
if scope < 1 {
|
||||
return Ok(());
|
||||
} else {
|
||||
scope -= 1;
|
||||
}
|
||||
|
||||
scope -= 1;
|
||||
}
|
||||
'(' => scope += 1,
|
||||
'"' | '\'' => {
|
||||
|
@ -42,10 +42,10 @@ impl<'a> Parser<'a> {
|
||||
')' => {
|
||||
if nesting == 0 {
|
||||
break;
|
||||
} else {
|
||||
nesting -= 1;
|
||||
buf.push(')');
|
||||
}
|
||||
|
||||
nesting -= 1;
|
||||
buf.push(')');
|
||||
}
|
||||
q @ '\'' | q @ '"' => {
|
||||
buf.push('"');
|
||||
@ -123,9 +123,9 @@ impl<'a> Parser<'a> {
|
||||
buf.push(')');
|
||||
self.toks.truncate_iterator_to_cursor();
|
||||
return Ok(Some(buf));
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
|
||||
break;
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
@ -211,7 +211,7 @@ impl<'a> Parser<'a> {
|
||||
) {
|
||||
return Ok(None);
|
||||
}
|
||||
buf.push_str("min(")
|
||||
buf.push_str("min(");
|
||||
}
|
||||
Some(Token { kind: 'a', .. }) | Some(Token { kind: 'A', .. }) => {
|
||||
self.toks.advance_cursor();
|
||||
@ -221,7 +221,7 @@ impl<'a> Parser<'a> {
|
||||
) {
|
||||
return Ok(None);
|
||||
}
|
||||
buf.push_str("max(")
|
||||
buf.push_str("max(");
|
||||
}
|
||||
_ => return Ok(None),
|
||||
}
|
||||
|
@ -89,8 +89,8 @@ impl<'a, 'b: 'a> ValueVisitor<'a, 'b> {
|
||||
Op::Mul => self.mul(val1, val2)?,
|
||||
Op::Div => self.div(val1, val2, in_parens)?,
|
||||
Op::Rem => self.rem(val1, val2)?,
|
||||
Op::And => Self::and(val1, val2)?,
|
||||
Op::Or => Self::or(val1, val2)?,
|
||||
Op::And => Self::and(val1, val2),
|
||||
Op::Or => Self::or(val1, val2),
|
||||
Op::Equal => Self::equal(val1, val2),
|
||||
Op::NotEqual => Self::not_equal(val1, val2),
|
||||
Op::GreaterThan => self.greater_than(val1, val2)?,
|
||||
@ -110,7 +110,7 @@ impl<'a, 'b: 'a> ValueVisitor<'a, 'b> {
|
||||
let val = self.eval(val, in_parens)?;
|
||||
match op {
|
||||
Op::Minus => self.unary_minus(val),
|
||||
Op::Not => Self::unary_not(&val),
|
||||
Op::Not => Ok(Self::unary_not(&val)),
|
||||
Op::Plus => self.unary_plus(val),
|
||||
_ => unreachable!(),
|
||||
}
|
||||
@ -133,8 +133,8 @@ impl<'a, 'b: 'a> ValueVisitor<'a, 'b> {
|
||||
})
|
||||
}
|
||||
|
||||
fn unary_not(val: &Value) -> SassResult<Value> {
|
||||
Ok(Value::bool(!val.is_true()))
|
||||
fn unary_not(val: &Value) -> Value {
|
||||
Value::bool(!val.is_true())
|
||||
}
|
||||
|
||||
fn unary(
|
||||
@ -697,7 +697,7 @@ impl<'a, 'b: 'a> ValueVisitor<'a, 'b> {
|
||||
})
|
||||
}
|
||||
|
||||
fn and(left: HigherIntermediateValue, right: HigherIntermediateValue) -> SassResult<Value> {
|
||||
fn and(left: HigherIntermediateValue, right: HigherIntermediateValue) -> Value {
|
||||
let left = match left {
|
||||
HigherIntermediateValue::Literal(v) => v,
|
||||
v => panic!("{:?}", v),
|
||||
@ -706,10 +706,14 @@ impl<'a, 'b: 'a> ValueVisitor<'a, 'b> {
|
||||
HigherIntermediateValue::Literal(v) => v,
|
||||
v => panic!("{:?}", v),
|
||||
};
|
||||
Ok(if left.is_true() { right } else { left })
|
||||
if left.is_true() {
|
||||
right
|
||||
} else {
|
||||
left
|
||||
}
|
||||
}
|
||||
|
||||
fn or(left: HigherIntermediateValue, right: HigherIntermediateValue) -> SassResult<Value> {
|
||||
fn or(left: HigherIntermediateValue, right: HigherIntermediateValue) -> Value {
|
||||
let left = match left {
|
||||
HigherIntermediateValue::Literal(v) => v,
|
||||
v => panic!("{:?}", v),
|
||||
@ -718,7 +722,11 @@ impl<'a, 'b: 'a> ValueVisitor<'a, 'b> {
|
||||
HigherIntermediateValue::Literal(v) => v,
|
||||
v => panic!("{:?}", v),
|
||||
};
|
||||
Ok(if left.is_true() { left } else { right })
|
||||
if left.is_true() {
|
||||
left
|
||||
} else {
|
||||
right
|
||||
}
|
||||
}
|
||||
|
||||
pub fn equal(left: HigherIntermediateValue, right: HigherIntermediateValue) -> Value {
|
||||
|
@ -78,7 +78,7 @@ impl<'a> Parser<'a> {
|
||||
match val.node {
|
||||
IntermediateValue::Value(v) => {
|
||||
last_was_whitespace = false;
|
||||
space_separated.push(v.span(val.span))
|
||||
space_separated.push(v.span(val.span));
|
||||
}
|
||||
IntermediateValue::Op(op) => {
|
||||
iter.parse_op(
|
||||
@ -260,25 +260,25 @@ impl<'a> Parser<'a> {
|
||||
self.parse_call_args()?,
|
||||
))
|
||||
.span(self.span_before));
|
||||
} else {
|
||||
// check for special cased CSS functions
|
||||
match unvendor(&lower) {
|
||||
"calc" | "element" | "expression" => {
|
||||
s = lower;
|
||||
self.parse_calc_args(&mut s)?;
|
||||
}
|
||||
"url" => match self.try_parse_url()? {
|
||||
Some(val) => s = val,
|
||||
None => s.push_str(&self.parse_call_args()?.to_css_string()?),
|
||||
},
|
||||
_ => s.push_str(&self.parse_call_args()?.to_css_string()?),
|
||||
}
|
||||
|
||||
return Ok(IntermediateValue::Value(HigherIntermediateValue::Literal(
|
||||
Value::String(s, QuoteKind::None),
|
||||
))
|
||||
.span(self.span_before));
|
||||
}
|
||||
|
||||
// check for special cased CSS functions
|
||||
match unvendor(&lower) {
|
||||
"calc" | "element" | "expression" => {
|
||||
s = lower;
|
||||
self.parse_calc_args(&mut s)?;
|
||||
}
|
||||
"url" => match self.try_parse_url()? {
|
||||
Some(val) => s = val,
|
||||
None => s.push_str(&self.parse_call_args()?.to_css_string()?),
|
||||
},
|
||||
_ => s.push_str(&self.parse_call_args()?.to_css_string()?),
|
||||
}
|
||||
|
||||
return Ok(IntermediateValue::Value(HigherIntermediateValue::Literal(
|
||||
Value::String(s, QuoteKind::None),
|
||||
))
|
||||
.span(self.span_before));
|
||||
}
|
||||
};
|
||||
|
||||
@ -804,9 +804,9 @@ impl<'a> Parser<'a> {
|
||||
self.toks.next();
|
||||
self.toks.next();
|
||||
return Some(self.parse_unicode_range(kind));
|
||||
} else {
|
||||
self.toks.reset_cursor();
|
||||
}
|
||||
|
||||
self.toks.reset_cursor();
|
||||
}
|
||||
return Some(self.parse_ident_value(predicate));
|
||||
}
|
||||
@ -1157,8 +1157,10 @@ impl<'a, 'b: 'a> IntermediateValueIterator<'a, 'b> {
|
||||
}
|
||||
}
|
||||
Op::Minus => {
|
||||
if self.whitespace() || !last_was_whitespace {
|
||||
let right = self.single_value(in_paren)?;
|
||||
let may_be_subtraction = self.whitespace() || !last_was_whitespace;
|
||||
let right = self.single_value(in_paren)?;
|
||||
|
||||
if may_be_subtraction {
|
||||
if let Some(left) = space_separated.pop() {
|
||||
space_separated.push(Spanned {
|
||||
node: HigherIntermediateValue::BinaryOp(
|
||||
@ -1176,7 +1178,6 @@ impl<'a, 'b: 'a> IntermediateValueIterator<'a, 'b> {
|
||||
);
|
||||
}
|
||||
} else {
|
||||
let right = self.single_value(in_paren)?;
|
||||
space_separated.push(
|
||||
right.map_node(|n| HigherIntermediateValue::UnaryOp(op.node, Box::new(n))),
|
||||
);
|
||||
|
@ -157,7 +157,7 @@ impl<'a> Parser<'a> {
|
||||
Some(..) | None => {
|
||||
value?;
|
||||
self.expect_char(';')?;
|
||||
unreachable!()
|
||||
unreachable!();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -170,6 +170,7 @@ impl Attribute {
|
||||
}
|
||||
|
||||
impl Display for Attribute {
|
||||
#[allow(clippy::branches_sharing_code)]
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
f.write_char('[')?;
|
||||
write!(f, "{}", self.attr)?;
|
||||
@ -249,16 +250,17 @@ enum AttributeOp {
|
||||
Contains,
|
||||
}
|
||||
|
||||
impl Into<&'static str> for AttributeOp {
|
||||
fn into(self) -> &'static str {
|
||||
match self {
|
||||
Self::Any => "",
|
||||
Self::Equals => "=",
|
||||
Self::Include => "~=",
|
||||
Self::Dash => "|=",
|
||||
Self::Prefix => "^=",
|
||||
Self::Suffix => "$=",
|
||||
Self::Contains => "*=",
|
||||
impl From<AttributeOp> for &'static str {
|
||||
#[inline]
|
||||
fn from(op: AttributeOp) -> Self {
|
||||
match op {
|
||||
AttributeOp::Any => "",
|
||||
AttributeOp::Equals => "=",
|
||||
AttributeOp::Include => "~=",
|
||||
AttributeOp::Dash => "|=",
|
||||
AttributeOp::Prefix => "^=",
|
||||
AttributeOp::Suffix => "$=",
|
||||
AttributeOp::Contains => "*=",
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -25,7 +25,7 @@ impl Hash for ExtendedSelector {
|
||||
// but I haven't managed to find a test case
|
||||
// that exhibits it.
|
||||
fn hash<H: Hasher>(&self, state: &mut H) {
|
||||
ptr::hash(&*self.0, state)
|
||||
ptr::hash(&*self.0, state);
|
||||
// in case we need to hash the actual value:
|
||||
// self.0.borrow().hash(state);
|
||||
}
|
||||
@ -66,8 +66,13 @@ impl SelectorHashSet {
|
||||
pub fn insert(&mut self, selector: ExtendedSelector) {
|
||||
self.0.insert(selector);
|
||||
}
|
||||
}
|
||||
|
||||
pub fn into_iter(self) -> IntoIter<ExtendedSelector> {
|
||||
impl IntoIterator for SelectorHashSet {
|
||||
type Item = ExtendedSelector;
|
||||
type IntoIter = IntoIter<ExtendedSelector>;
|
||||
|
||||
fn into_iter(self) -> Self::IntoIter {
|
||||
self.0.into_iter()
|
||||
}
|
||||
}
|
||||
|
@ -59,6 +59,7 @@ impl Extension {
|
||||
// todo: this should return a `Result`. it currently does not because the cascade effect
|
||||
// from this returning a `Result` will make some code returning `Option`s much uglier (we can't
|
||||
// use `?` to return both `Option` and `Result` from the same function)
|
||||
#[allow(clippy::needless_return)]
|
||||
pub fn assert_compatible_media_context(&self, media_context: &Option<Vec<CssMediaQuery>>) {
|
||||
if &self.media_context == media_context {
|
||||
return;
|
||||
|
@ -416,12 +416,12 @@ fn merge_final_combinators(
|
||||
result.push_front(vec![vec![
|
||||
ComplexSelectorComponent::Compound(compound_two),
|
||||
ComplexSelectorComponent::Combinator(Combinator::FollowingSibling),
|
||||
]])
|
||||
]]);
|
||||
} else if compound_two.is_super_selector(&compound_one, &None) {
|
||||
result.push_front(vec![vec![
|
||||
ComplexSelectorComponent::Compound(compound_one),
|
||||
ComplexSelectorComponent::Combinator(Combinator::FollowingSibling),
|
||||
]])
|
||||
]]);
|
||||
} else {
|
||||
let mut choices = vec![
|
||||
vec![
|
||||
@ -442,7 +442,7 @@ fn merge_final_combinators(
|
||||
choices.push(vec![
|
||||
ComplexSelectorComponent::Compound(unified),
|
||||
ComplexSelectorComponent::Combinator(Combinator::FollowingSibling),
|
||||
])
|
||||
]);
|
||||
}
|
||||
|
||||
result.push_front(choices);
|
||||
|
@ -527,13 +527,7 @@ impl Extender {
|
||||
})
|
||||
.collect();
|
||||
|
||||
Some(
|
||||
unified_paths
|
||||
.into_iter()
|
||||
.filter_map(|complexes| complexes)
|
||||
.flatten()
|
||||
.collect(),
|
||||
)
|
||||
Some(unified_paths.into_iter().flatten().flatten().collect())
|
||||
}
|
||||
|
||||
fn extend_simple(
|
||||
@ -837,7 +831,7 @@ impl Extender {
|
||||
let mut max_specificity = 0;
|
||||
for component in &complex1.components {
|
||||
if let ComplexSelectorComponent::Compound(compound) = component {
|
||||
max_specificity = max_specificity.max(self.source_specificity_for(compound))
|
||||
max_specificity = max_specificity.max(self.source_specificity_for(compound));
|
||||
}
|
||||
}
|
||||
|
||||
@ -920,7 +914,7 @@ impl Extender {
|
||||
// clone in cases where we have already seen a simple selector (common in
|
||||
// scenarios in which there is a lot of nesting)
|
||||
if let Some(entry) = self.selectors.get_mut(&simple) {
|
||||
entry.insert(selector.clone())
|
||||
entry.insert(selector.clone());
|
||||
} else {
|
||||
self.selectors
|
||||
.entry(simple.clone())
|
||||
@ -1146,7 +1140,7 @@ impl Extender {
|
||||
selectors: SelectorHashSet,
|
||||
new_extensions: &HashMap<SimpleSelector, IndexMap<ComplexSelector, Extension>>,
|
||||
) {
|
||||
for mut selector in selectors.into_iter() {
|
||||
for mut selector in selectors {
|
||||
let old_value = selector.clone().into_selector().0;
|
||||
selector.set_inner(self.extend_list(
|
||||
old_value.clone(),
|
||||
@ -1193,7 +1187,7 @@ fn map_add_all_2<K1: Hash + Eq, K2: Hash + Eq, V>(
|
||||
destination: &mut HashMap<K1, IndexMap<K2, V>>,
|
||||
source: HashMap<K1, IndexMap<K2, V>>,
|
||||
) {
|
||||
source.into_iter().for_each(|(key, mut inner)| {
|
||||
for (key, mut inner) in source {
|
||||
if destination.contains_key(&key) {
|
||||
destination
|
||||
.get_mut(&key)
|
||||
@ -1202,5 +1196,5 @@ fn map_add_all_2<K1: Hash + Eq, K2: Hash + Eq, V>(
|
||||
} else {
|
||||
destination.get_mut(&key).replace(&mut inner);
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
@ -69,9 +69,9 @@ impl<'a, 'b> SelectorParser<'a, 'b> {
|
||||
span: Span,
|
||||
) -> Self {
|
||||
Self {
|
||||
parser,
|
||||
allows_parent,
|
||||
allows_placeholder,
|
||||
parser,
|
||||
span,
|
||||
}
|
||||
}
|
||||
@ -144,7 +144,7 @@ impl<'a, 'b> SelectorParser<'a, 'b> {
|
||||
}
|
||||
Some(Token { kind: '>', .. }) => {
|
||||
self.parser.toks.next();
|
||||
components.push(ComplexSelectorComponent::Combinator(Combinator::Child))
|
||||
components.push(ComplexSelectorComponent::Combinator(Combinator::Child));
|
||||
}
|
||||
Some(Token { kind: '~', .. }) => {
|
||||
self.parser.toks.next();
|
||||
@ -350,7 +350,7 @@ impl<'a, 'b> SelectorParser<'a, 'b> {
|
||||
argument = Some(
|
||||
self.declaration_value()?
|
||||
.trim_end()
|
||||
.to_string()
|
||||
.to_owned()
|
||||
.into_boxed_str(),
|
||||
);
|
||||
}
|
||||
@ -397,15 +397,15 @@ impl<'a, 'b> SelectorParser<'a, 'b> {
|
||||
if let Some(Token { kind: '*', .. }) = self.parser.toks.peek() {
|
||||
self.parser.toks.next();
|
||||
return Ok(SimpleSelector::Universal(Namespace::Asterisk));
|
||||
} else {
|
||||
return Ok(SimpleSelector::Type(QualifiedName {
|
||||
ident: self.parser.parse_identifier()?.node,
|
||||
namespace: Namespace::Asterisk,
|
||||
}));
|
||||
}
|
||||
} else {
|
||||
return Ok(SimpleSelector::Universal(Namespace::None));
|
||||
|
||||
return Ok(SimpleSelector::Type(QualifiedName {
|
||||
ident: self.parser.parse_identifier()?.node,
|
||||
namespace: Namespace::Asterisk,
|
||||
}));
|
||||
}
|
||||
|
||||
return Ok(SimpleSelector::Universal(Namespace::None));
|
||||
}
|
||||
Some(Token { kind: '|', pos }) => {
|
||||
self.parser.span_before = self.parser.span_before.merge(*pos);
|
||||
@ -457,11 +457,11 @@ impl<'a, 'b> SelectorParser<'a, 'b> {
|
||||
match self.parser.toks.peek() {
|
||||
Some(Token { kind: 'e', .. }) | Some(Token { kind: 'E', .. }) => {
|
||||
self.expect_identifier("even")?;
|
||||
return Ok("even".to_string());
|
||||
return Ok("even".to_owned());
|
||||
}
|
||||
Some(Token { kind: 'o', .. }) | Some(Token { kind: 'O', .. }) => {
|
||||
self.expect_identifier("odd")?;
|
||||
return Ok("odd".to_string());
|
||||
return Ok("odd".to_owned());
|
||||
}
|
||||
Some(t @ Token { kind: '+', .. }) | Some(t @ Token { kind: '-', .. }) => {
|
||||
buf.push(t.kind);
|
||||
|
@ -28,11 +28,11 @@ pub(crate) fn peek_until_closing_curly_brace(
|
||||
'}' => {
|
||||
if nesting == 0 {
|
||||
break;
|
||||
} else {
|
||||
nesting -= 1;
|
||||
t.push(tok);
|
||||
toks.advance_cursor();
|
||||
}
|
||||
|
||||
nesting -= 1;
|
||||
t.push(tok);
|
||||
toks.advance_cursor();
|
||||
}
|
||||
'/' => {
|
||||
let next = *toks
|
||||
|
@ -67,10 +67,10 @@ pub(crate) fn read_until_closing_curly_brace(
|
||||
'}' => {
|
||||
if nesting == 0 {
|
||||
break;
|
||||
} else {
|
||||
nesting -= 1;
|
||||
buf.push(toks.next().unwrap());
|
||||
}
|
||||
|
||||
nesting -= 1;
|
||||
buf.push(toks.next().unwrap());
|
||||
}
|
||||
'/' => {
|
||||
let next = toks.next().unwrap();
|
||||
@ -179,10 +179,10 @@ pub(crate) fn read_until_semicolon_or_closing_curly_brace(
|
||||
'}' => {
|
||||
if nesting == 0 {
|
||||
break;
|
||||
} else {
|
||||
nesting -= 1;
|
||||
t.push(toks.next().unwrap());
|
||||
}
|
||||
|
||||
nesting -= 1;
|
||||
t.push(toks.next().unwrap());
|
||||
}
|
||||
'/' => {
|
||||
let next = toks.next().unwrap();
|
||||
@ -213,9 +213,9 @@ pub(crate) fn read_until_closing_paren(
|
||||
if scope < 1 {
|
||||
t.push(tok);
|
||||
return Ok(t);
|
||||
} else {
|
||||
scope -= 1;
|
||||
}
|
||||
|
||||
scope -= 1;
|
||||
}
|
||||
'(' => scope += 1,
|
||||
'"' | '\'' => {
|
||||
@ -231,7 +231,7 @@ pub(crate) fn read_until_closing_paren(
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
t.push(tok)
|
||||
t.push(tok);
|
||||
}
|
||||
Ok(t)
|
||||
}
|
||||
|
@ -153,7 +153,7 @@ fn visit_quoted_string(buf: &mut String, force_double_quote: bool, string: &str)
|
||||
'\x00'..='\x08' | '\x0A'..='\x1F' => {
|
||||
buffer.push('\\');
|
||||
if c as u32 > 0xF {
|
||||
buffer.push(hex_char_for(c as u32 >> 4))
|
||||
buffer.push(hex_char_for(c as u32 >> 4));
|
||||
}
|
||||
buffer.push(hex_char_for(c as u32 & 0xF));
|
||||
|
||||
@ -205,9 +205,9 @@ impl Value {
|
||||
return Err(
|
||||
(format!("{}{} isn't a valid CSS value.", num, unit), span).into()
|
||||
);
|
||||
} else {
|
||||
return Err((format!("NaN{} isn't a valid CSS value.", unit), span).into());
|
||||
}
|
||||
|
||||
return Err((format!("NaN{} isn't a valid CSS value.", unit), span).into());
|
||||
}
|
||||
_ => {
|
||||
if let Some(num) = num {
|
||||
@ -278,7 +278,7 @@ impl Value {
|
||||
Value::ArgList(args) => Cow::owned(
|
||||
args.iter()
|
||||
.filter(|x| !x.is_null())
|
||||
.map(|a| Ok(a.node.to_css_string(span)?))
|
||||
.map(|a| a.node.to_css_string(span))
|
||||
.collect::<SassResult<Vec<Cow<'static, str>>>>()?
|
||||
.join(", "),
|
||||
),
|
||||
@ -464,14 +464,14 @@ impl Value {
|
||||
"({},)",
|
||||
args.iter()
|
||||
.filter(|x| !x.is_null())
|
||||
.map(|a| Ok(a.node.inspect(span)?))
|
||||
.map(|a| a.node.inspect(span))
|
||||
.collect::<SassResult<Vec<Cow<'static, str>>>>()?
|
||||
.join(", "),
|
||||
)),
|
||||
Value::ArgList(args) => Cow::owned(
|
||||
args.iter()
|
||||
.filter(|x| !x.is_null())
|
||||
.map(|a| Ok(a.node.inspect(span)?))
|
||||
.map(|a| a.node.inspect(span))
|
||||
.collect::<SassResult<Vec<Cow<'static, str>>>>()?
|
||||
.join(", "),
|
||||
),
|
||||
|
Loading…
x
Reference in New Issue
Block a user