clippy
This commit is contained in:
parent
8711e61398
commit
269f37034a
@ -72,7 +72,7 @@ impl Function {
|
|||||||
for (idx, arg) in self.args.0.iter().enumerate() {
|
for (idx, arg) in self.args.0.iter().enumerate() {
|
||||||
if arg.is_variadic {
|
if arg.is_variadic {
|
||||||
let span = args.span();
|
let span = args.span();
|
||||||
let arg_list = Value::ArgList(args.get_variadic(&mut scope, super_selector)?);
|
let arg_list = Value::ArgList(args.get_variadic(&scope, super_selector)?);
|
||||||
scope.insert_var(
|
scope.insert_var(
|
||||||
&arg.name,
|
&arg.name,
|
||||||
Spanned {
|
Spanned {
|
||||||
@ -82,14 +82,14 @@ impl Function {
|
|||||||
)?;
|
)?;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
let val = match args.get_positional(idx, &mut scope, super_selector) {
|
let val = match args.get_positional(idx, &scope, super_selector) {
|
||||||
Some(v) => v?,
|
Some(v) => v?,
|
||||||
None => match args.get_named(arg.name.clone(), &mut scope, super_selector) {
|
None => match args.get_named(arg.name.clone(), &scope, super_selector) {
|
||||||
Some(v) => v?,
|
Some(v) => v?,
|
||||||
None => match &arg.default {
|
None => match &arg.default {
|
||||||
Some(v) => Value::from_tokens(
|
Some(v) => Value::from_tokens(
|
||||||
&mut v.iter().cloned().peekmore(),
|
&mut v.iter().cloned().peekmore(),
|
||||||
&mut scope,
|
&scope,
|
||||||
super_selector,
|
super_selector,
|
||||||
)?,
|
)?,
|
||||||
None => {
|
None => {
|
||||||
|
@ -132,7 +132,7 @@ impl Mixin {
|
|||||||
stmts.extend(i.eval(&mut self.scope.clone(), super_selector, content)?)
|
stmts.extend(i.eval(&mut self.scope.clone(), super_selector, content)?)
|
||||||
}
|
}
|
||||||
AtRule::Content => {
|
AtRule::Content => {
|
||||||
stmts.extend(content.unwrap_or_default().into_iter().cloned());
|
stmts.extend(content.unwrap_or_default().iter().cloned());
|
||||||
}
|
}
|
||||||
AtRule::Return(..) => {
|
AtRule::Return(..) => {
|
||||||
return Err(("This at-rule is not allowed here.", span).into())
|
return Err(("This at-rule is not allowed here.", span).into())
|
||||||
|
@ -135,7 +135,7 @@ pub(crate) fn ruleset_eval<I: Iterator<Item = Token>>(
|
|||||||
Stmt::AtRule(AtRule::If(i)) => stmts.extend(i.eval(scope, super_selector, content)?),
|
Stmt::AtRule(AtRule::If(i)) => stmts.extend(i.eval(scope, super_selector, content)?),
|
||||||
Stmt::AtRule(AtRule::Content) => {
|
Stmt::AtRule(AtRule::Content) => {
|
||||||
if let Some(c) = content {
|
if let Some(c) = content {
|
||||||
stmts.extend(c.into_iter().cloned());
|
stmts.extend(c.iter().cloned());
|
||||||
} else {
|
} else {
|
||||||
return Err((
|
return Err((
|
||||||
"@content is only allowed within mixin declarations.",
|
"@content is only allowed within mixin declarations.",
|
||||||
|
@ -500,7 +500,7 @@ fn repr(red: &Number, green: &Number, blue: &Number, alpha: &Number) -> String {
|
|||||||
if alpha < &Number::one() {
|
if alpha < &Number::one() {
|
||||||
format!("rgba({}, {}, {}, {})", red, green, blue, alpha)
|
format!("rgba({}, {}, {}, {})", red, green, blue, alpha)
|
||||||
} else if let Some(c) = NAMED_COLORS.get_by_right(&[red, green, blue, 0xFF]) {
|
} else if let Some(c) = NAMED_COLORS.get_by_right(&[red, green, blue, 0xFF]) {
|
||||||
format!("{}", c)
|
c.to_string()
|
||||||
} else {
|
} else {
|
||||||
format!("#{:0>2x}{:0>2x}{:0>2x}", red, green, blue)
|
format!("#{:0>2x}{:0>2x}{:0>2x}", red, green, blue)
|
||||||
}
|
}
|
||||||
|
@ -106,7 +106,7 @@ impl StyleSheet {
|
|||||||
#[cfg(not(feature = "wasm"))]
|
#[cfg(not(feature = "wasm"))]
|
||||||
pub fn from_path(p: &str) -> SassResult<String> {
|
pub fn from_path(p: &str) -> SassResult<String> {
|
||||||
let mut map = CodeMap::new();
|
let mut map = CodeMap::new();
|
||||||
let file = map.add_file(p.clone().into(), String::from_utf8(fs::read(p.clone())?)?);
|
let file = map.add_file(p.into(), String::from_utf8(fs::read(p)?)?);
|
||||||
Css::from_stylesheet(StyleSheet(
|
Css::from_stylesheet(StyleSheet(
|
||||||
StyleSheetParser {
|
StyleSheetParser {
|
||||||
lexer: Lexer::new(&file).peekmore(),
|
lexer: Lexer::new(&file).peekmore(),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user