remove allows from modules

This commit is contained in:
Connor Skees 2020-08-06 03:53:18 -04:00
parent d029fd2001
commit de9571b3fe
8 changed files with 29 additions and 59 deletions

View File

@ -1,6 +1,4 @@
use crate::{ use crate::builtin::{
args::CallArgs,
builtin::{
color::{ color::{
hsl::{complement, grayscale, hue, invert, lightness, saturation}, hsl::{complement, grayscale, hue, invert, lightness, saturation},
opacity::alpha, opacity::alpha,
@ -8,10 +6,6 @@ use crate::{
rgb::{blue, green, mix, red}, rgb::{blue, green, mix, red},
}, },
modules::Module, modules::Module,
},
error::SassResult,
parse::Parser,
value::Value,
}; };
pub(crate) fn declare(f: &mut Module) { pub(crate) fn declare(f: &mut Module) {

View File

@ -1,12 +1,6 @@
use crate::{ use crate::builtin::{
args::CallArgs,
builtin::{
list::{append, index, is_bracketed, join, length, list_separator, nth, set_nth, zip}, list::{append, index, is_bracketed, join, length, list_separator, nth, set_nth, zip},
modules::Module, modules::Module,
},
error::SassResult,
parse::Parser,
value::Value,
}; };
pub(crate) fn declare(f: &mut Module) { pub(crate) fn declare(f: &mut Module) {

View File

@ -1,12 +1,6 @@
use crate::{ use crate::builtin::{
args::CallArgs,
builtin::{
map::{map_get, map_has_key, map_keys, map_merge, map_remove, map_values}, map::{map_get, map_has_key, map_keys, map_merge, map_remove, map_values},
modules::Module, modules::Module,
},
error::SassResult,
parse::Parser,
value::Value,
}; };
pub(crate) fn declare(f: &mut Module) { pub(crate) fn declare(f: &mut Module) {

View File

@ -19,7 +19,7 @@ use crate::{
#[cfg(feature = "random")] #[cfg(feature = "random")]
use crate::builtin::math::random; use crate::builtin::math::random;
fn clamp(mut args: CallArgs, parser: &mut Parser<'_>) -> SassResult<Value> { fn clamp(mut args: CallArgs, _: &mut Parser<'_>) -> SassResult<Value> {
args.max_args(3)?; args.max_args(3)?;
let span = args.span(); let span = args.span();
@ -101,7 +101,7 @@ fn clamp(mut args: CallArgs, parser: &mut Parser<'_>) -> SassResult<Value> {
Ok(number) Ok(number)
} }
fn hypot(mut args: CallArgs, parser: &mut Parser<'_>) -> SassResult<Value> { fn hypot(args: CallArgs, _: &mut Parser<'_>) -> SassResult<Value> {
args.min_args(1)?; args.min_args(1)?;
let span = args.span(); let span = args.span();
@ -172,7 +172,7 @@ fn hypot(mut args: CallArgs, parser: &mut Parser<'_>) -> SassResult<Value> {
Ok(Value::Dimension(sum.sqrt(), first.1, true)) Ok(Value::Dimension(sum.sqrt(), first.1, true))
} }
fn log(mut args: CallArgs, parser: &mut Parser<'_>) -> SassResult<Value> { fn log(mut args: CallArgs, _: &mut Parser<'_>) -> SassResult<Value> {
args.max_args(2)?; args.max_args(2)?;
let number = match args.get_err(0, "number")? { let number = match args.get_err(0, "number")? {
@ -239,7 +239,7 @@ fn log(mut args: CallArgs, parser: &mut Parser<'_>) -> SassResult<Value> {
)) ))
} }
fn pow(mut args: CallArgs, parser: &mut Parser<'_>) -> SassResult<Value> { fn pow(mut args: CallArgs, _: &mut Parser<'_>) -> SassResult<Value> {
args.max_args(2)?; args.max_args(2)?;
let base = match args.get_err(0, "base")? { let base = match args.get_err(0, "base")? {
@ -289,7 +289,7 @@ fn pow(mut args: CallArgs, parser: &mut Parser<'_>) -> SassResult<Value> {
Ok(Value::Dimension(base.pow(exponent), Unit::None, true)) Ok(Value::Dimension(base.pow(exponent), Unit::None, true))
} }
fn sqrt(mut args: CallArgs, parser: &mut Parser<'_>) -> SassResult<Value> { fn sqrt(mut args: CallArgs, _: &mut Parser<'_>) -> SassResult<Value> {
args.max_args(1)?; args.max_args(1)?;
let number = args.get_err(0, "number")?; let number = args.get_err(0, "number")?;
@ -318,7 +318,7 @@ fn sqrt(mut args: CallArgs, parser: &mut Parser<'_>) -> SassResult<Value> {
macro_rules! trig_fn { macro_rules! trig_fn {
($name:ident, $name_deg:ident) => { ($name:ident, $name_deg:ident) => {
fn $name(mut args: CallArgs, parser: &mut Parser<'_>) -> SassResult<Value> { fn $name(mut args: CallArgs, _: &mut Parser<'_>) -> SassResult<Value> {
args.max_args(1)?; args.max_args(1)?;
let number = args.get_err(0, "number")?; let number = args.get_err(0, "number")?;
@ -357,7 +357,7 @@ trig_fn!(cos, cos_deg);
trig_fn!(sin, sin_deg); trig_fn!(sin, sin_deg);
trig_fn!(tan, tan_deg); trig_fn!(tan, tan_deg);
fn acos(mut args: CallArgs, parser: &mut Parser<'_>) -> SassResult<Value> { fn acos(mut args: CallArgs, _: &mut Parser<'_>) -> SassResult<Value> {
args.max_args(1)?; args.max_args(1)?;
let number = args.get_err(0, "number")?; let number = args.get_err(0, "number")?;
@ -394,7 +394,7 @@ fn acos(mut args: CallArgs, parser: &mut Parser<'_>) -> SassResult<Value> {
}) })
} }
fn asin(mut args: CallArgs, parser: &mut Parser<'_>) -> SassResult<Value> { fn asin(mut args: CallArgs, _: &mut Parser<'_>) -> SassResult<Value> {
args.max_args(1)?; args.max_args(1)?;
let number = args.get_err(0, "number")?; let number = args.get_err(0, "number")?;
@ -429,7 +429,7 @@ fn asin(mut args: CallArgs, parser: &mut Parser<'_>) -> SassResult<Value> {
}) })
} }
fn atan(mut args: CallArgs, parser: &mut Parser<'_>) -> SassResult<Value> { fn atan(mut args: CallArgs, _: &mut Parser<'_>) -> SassResult<Value> {
args.max_args(1)?; args.max_args(1)?;
let number = args.get_err(0, "number")?; let number = args.get_err(0, "number")?;
@ -462,7 +462,7 @@ fn atan(mut args: CallArgs, parser: &mut Parser<'_>) -> SassResult<Value> {
}) })
} }
fn atan2(mut args: CallArgs, parser: &mut Parser<'_>) -> SassResult<Value> { fn atan2(mut args: CallArgs, _: &mut Parser<'_>) -> SassResult<Value> {
args.max_args(2)?; args.max_args(2)?;
let (y_num, y_unit) = match args.get_err(0, "y")? { let (y_num, y_unit) = match args.get_err(0, "y")? {
Value::Dimension(n, u, ..) => (n, u), Value::Dimension(n, u, ..) => (n, u),

View File

@ -39,7 +39,7 @@ fn load_css(mut args: CallArgs, parser: &mut Parser<'_>) -> SassResult<Vec<Stmt>
} }
}; };
if let Some(with) = with { if let Some(..) = with {
todo!("`$with` to `load-css` not yet implemented") todo!("`$with` to `load-css` not yet implemented")
} else { } else {
parser.parse_single_import(&url, args.span()) parser.parse_single_import(&url, args.span())

View File

@ -1,5 +1,3 @@
#![allow(unused_imports, unused_variables, dead_code, unused_mut)]
use std::collections::BTreeMap; use std::collections::BTreeMap;
use codemap::{Span, Spanned}; use codemap::{Span, Spanned};

View File

@ -1,13 +1,9 @@
use crate::{ use crate::{
args::CallArgs,
builtin::modules::Module, builtin::modules::Module,
builtin::selector::{ builtin::selector::{
is_superselector, selector_append, selector_extend, selector_nest, selector_parse, is_superselector, selector_append, selector_extend, selector_nest, selector_parse,
selector_replace, selector_unify, simple_selectors, selector_replace, selector_unify, simple_selectors,
}, },
error::SassResult,
parse::Parser,
value::Value,
}; };
pub(crate) fn declare(f: &mut Module) { pub(crate) fn declare(f: &mut Module) {

View File

@ -1,15 +1,8 @@
use crate::{ use crate::builtin::{
args::CallArgs,
builtin::{
modules::Module, modules::Module,
string::{ string::{
quote, str_index, str_insert, str_length, str_slice, to_lower_case, to_upper_case, quote, str_index, str_insert, str_length, str_slice, to_lower_case, to_upper_case, unquote,
unquote,
}, },
},
error::SassResult,
parse::Parser,
value::Value,
}; };
#[cfg(feature = "random")] #[cfg(feature = "random")]
@ -25,4 +18,5 @@ pub(crate) fn declare(f: &mut Module) {
f.insert_builtin("to-upper-case", to_upper_case); f.insert_builtin("to-upper-case", to_upper_case);
#[cfg(feature = "random")] #[cfg(feature = "random")]
f.insert_builtin("unique-id", unique_id); f.insert_builtin("unique-id", unique_id);
f.insert_builtin("unquote", unquote);
} }