From de9571b3fef2df044b7678071b6ed05255c4f366 Mon Sep 17 00:00:00 2001 From: Connor Skees Date: Thu, 6 Aug 2020 03:53:18 -0400 Subject: [PATCH] remove `allow`s from modules --- src/builtin/modules/color.rs | 20 +++++++------------- src/builtin/modules/list.rs | 12 +++--------- src/builtin/modules/map.rs | 12 +++--------- src/builtin/modules/math.rs | 20 ++++++++++---------- src/builtin/modules/meta.rs | 2 +- src/builtin/modules/mod.rs | 2 -- src/builtin/modules/selector.rs | 4 ---- src/builtin/modules/string.rs | 16 +++++----------- 8 files changed, 29 insertions(+), 59 deletions(-) diff --git a/src/builtin/modules/color.rs b/src/builtin/modules/color.rs index 0a10449..f2cd754 100644 --- a/src/builtin/modules/color.rs +++ b/src/builtin/modules/color.rs @@ -1,17 +1,11 @@ -use crate::{ - args::CallArgs, - builtin::{ - color::{ - hsl::{complement, grayscale, hue, invert, lightness, saturation}, - opacity::alpha, - other::{adjust_color, change_color, ie_hex_str, scale_color}, - rgb::{blue, green, mix, red}, - }, - modules::Module, +use crate::builtin::{ + color::{ + hsl::{complement, grayscale, hue, invert, lightness, saturation}, + opacity::alpha, + other::{adjust_color, change_color, ie_hex_str, scale_color}, + rgb::{blue, green, mix, red}, }, - error::SassResult, - parse::Parser, - value::Value, + modules::Module, }; pub(crate) fn declare(f: &mut Module) { diff --git a/src/builtin/modules/list.rs b/src/builtin/modules/list.rs index ddd6611..16c7a6c 100644 --- a/src/builtin/modules/list.rs +++ b/src/builtin/modules/list.rs @@ -1,12 +1,6 @@ -use crate::{ - args::CallArgs, - builtin::{ - list::{append, index, is_bracketed, join, length, list_separator, nth, set_nth, zip}, - modules::Module, - }, - error::SassResult, - parse::Parser, - value::Value, +use crate::builtin::{ + list::{append, index, is_bracketed, join, length, list_separator, nth, set_nth, zip}, + modules::Module, }; pub(crate) fn declare(f: &mut Module) { diff --git a/src/builtin/modules/map.rs b/src/builtin/modules/map.rs index 5a349f5..13446ad 100644 --- a/src/builtin/modules/map.rs +++ b/src/builtin/modules/map.rs @@ -1,12 +1,6 @@ -use crate::{ - args::CallArgs, - builtin::{ - map::{map_get, map_has_key, map_keys, map_merge, map_remove, map_values}, - modules::Module, - }, - error::SassResult, - parse::Parser, - value::Value, +use crate::builtin::{ + map::{map_get, map_has_key, map_keys, map_merge, map_remove, map_values}, + modules::Module, }; pub(crate) fn declare(f: &mut Module) { diff --git a/src/builtin/modules/math.rs b/src/builtin/modules/math.rs index c49a52b..ecc553b 100644 --- a/src/builtin/modules/math.rs +++ b/src/builtin/modules/math.rs @@ -19,7 +19,7 @@ use crate::{ #[cfg(feature = "random")] use crate::builtin::math::random; -fn clamp(mut args: CallArgs, parser: &mut Parser<'_>) -> SassResult { +fn clamp(mut args: CallArgs, _: &mut Parser<'_>) -> SassResult { args.max_args(3)?; let span = args.span(); @@ -101,7 +101,7 @@ fn clamp(mut args: CallArgs, parser: &mut Parser<'_>) -> SassResult { Ok(number) } -fn hypot(mut args: CallArgs, parser: &mut Parser<'_>) -> SassResult { +fn hypot(args: CallArgs, _: &mut Parser<'_>) -> SassResult { args.min_args(1)?; let span = args.span(); @@ -172,7 +172,7 @@ fn hypot(mut args: CallArgs, parser: &mut Parser<'_>) -> SassResult { Ok(Value::Dimension(sum.sqrt(), first.1, true)) } -fn log(mut args: CallArgs, parser: &mut Parser<'_>) -> SassResult { +fn log(mut args: CallArgs, _: &mut Parser<'_>) -> SassResult { args.max_args(2)?; let number = match args.get_err(0, "number")? { @@ -239,7 +239,7 @@ fn log(mut args: CallArgs, parser: &mut Parser<'_>) -> SassResult { )) } -fn pow(mut args: CallArgs, parser: &mut Parser<'_>) -> SassResult { +fn pow(mut args: CallArgs, _: &mut Parser<'_>) -> SassResult { args.max_args(2)?; let base = match args.get_err(0, "base")? { @@ -289,7 +289,7 @@ fn pow(mut args: CallArgs, parser: &mut Parser<'_>) -> SassResult { Ok(Value::Dimension(base.pow(exponent), Unit::None, true)) } -fn sqrt(mut args: CallArgs, parser: &mut Parser<'_>) -> SassResult { +fn sqrt(mut args: CallArgs, _: &mut Parser<'_>) -> SassResult { args.max_args(1)?; let number = args.get_err(0, "number")?; @@ -318,7 +318,7 @@ fn sqrt(mut args: CallArgs, parser: &mut Parser<'_>) -> SassResult { macro_rules! trig_fn { ($name:ident, $name_deg:ident) => { - fn $name(mut args: CallArgs, parser: &mut Parser<'_>) -> SassResult { + fn $name(mut args: CallArgs, _: &mut Parser<'_>) -> SassResult { args.max_args(1)?; let number = args.get_err(0, "number")?; @@ -357,7 +357,7 @@ trig_fn!(cos, cos_deg); trig_fn!(sin, sin_deg); trig_fn!(tan, tan_deg); -fn acos(mut args: CallArgs, parser: &mut Parser<'_>) -> SassResult { +fn acos(mut args: CallArgs, _: &mut Parser<'_>) -> SassResult { args.max_args(1)?; let number = args.get_err(0, "number")?; @@ -394,7 +394,7 @@ fn acos(mut args: CallArgs, parser: &mut Parser<'_>) -> SassResult { }) } -fn asin(mut args: CallArgs, parser: &mut Parser<'_>) -> SassResult { +fn asin(mut args: CallArgs, _: &mut Parser<'_>) -> SassResult { args.max_args(1)?; let number = args.get_err(0, "number")?; @@ -429,7 +429,7 @@ fn asin(mut args: CallArgs, parser: &mut Parser<'_>) -> SassResult { }) } -fn atan(mut args: CallArgs, parser: &mut Parser<'_>) -> SassResult { +fn atan(mut args: CallArgs, _: &mut Parser<'_>) -> SassResult { args.max_args(1)?; let number = args.get_err(0, "number")?; @@ -462,7 +462,7 @@ fn atan(mut args: CallArgs, parser: &mut Parser<'_>) -> SassResult { }) } -fn atan2(mut args: CallArgs, parser: &mut Parser<'_>) -> SassResult { +fn atan2(mut args: CallArgs, _: &mut Parser<'_>) -> SassResult { args.max_args(2)?; let (y_num, y_unit) = match args.get_err(0, "y")? { Value::Dimension(n, u, ..) => (n, u), diff --git a/src/builtin/modules/meta.rs b/src/builtin/modules/meta.rs index bd1274e..e808be7 100644 --- a/src/builtin/modules/meta.rs +++ b/src/builtin/modules/meta.rs @@ -39,7 +39,7 @@ fn load_css(mut args: CallArgs, parser: &mut Parser<'_>) -> SassResult } }; - if let Some(with) = with { + if let Some(..) = with { todo!("`$with` to `load-css` not yet implemented") } else { parser.parse_single_import(&url, args.span()) diff --git a/src/builtin/modules/mod.rs b/src/builtin/modules/mod.rs index 1f1bcf6..555aeff 100644 --- a/src/builtin/modules/mod.rs +++ b/src/builtin/modules/mod.rs @@ -1,5 +1,3 @@ -#![allow(unused_imports, unused_variables, dead_code, unused_mut)] - use std::collections::BTreeMap; use codemap::{Span, Spanned}; diff --git a/src/builtin/modules/selector.rs b/src/builtin/modules/selector.rs index 32a7860..3181254 100644 --- a/src/builtin/modules/selector.rs +++ b/src/builtin/modules/selector.rs @@ -1,13 +1,9 @@ use crate::{ - args::CallArgs, builtin::modules::Module, builtin::selector::{ is_superselector, selector_append, selector_extend, selector_nest, selector_parse, selector_replace, selector_unify, simple_selectors, }, - error::SassResult, - parse::Parser, - value::Value, }; pub(crate) fn declare(f: &mut Module) { diff --git a/src/builtin/modules/string.rs b/src/builtin/modules/string.rs index 5e63c40..bd1b2cf 100644 --- a/src/builtin/modules/string.rs +++ b/src/builtin/modules/string.rs @@ -1,15 +1,8 @@ -use crate::{ - args::CallArgs, - builtin::{ - modules::Module, - string::{ - quote, str_index, str_insert, str_length, str_slice, to_lower_case, to_upper_case, - unquote, - }, +use crate::builtin::{ + modules::Module, + string::{ + quote, str_index, str_insert, str_length, str_slice, to_lower_case, to_upper_case, unquote, }, - error::SassResult, - parse::Parser, - value::Value, }; #[cfg(feature = "random")] @@ -25,4 +18,5 @@ pub(crate) fn declare(f: &mut Module) { f.insert_builtin("to-upper-case", to_upper_case); #[cfg(feature = "random")] f.insert_builtin("unique-id", unique_id); + f.insert_builtin("unquote", unquote); }