From a7c2ca7b82015c683bb0b5f0b88a64d07de0af92 Mon Sep 17 00:00:00 2001 From: connorskees Date: Mon, 16 Jan 2023 22:29:08 +0000 Subject: [PATCH] clippy --- README.md | 10 +++++++--- crates/compiler/src/builtin/functions/color/hwb.rs | 2 +- crates/compiler/src/builtin/modules/meta.rs | 12 ++++-------- crates/compiler/src/evaluate/visitor.rs | 2 +- crates/compiler/src/parse/stylesheet.rs | 2 +- crates/lib/Cargo.toml | 6 ------ 6 files changed, 14 insertions(+), 20 deletions(-) diff --git a/README.md b/README.md index 90369be..3db3595 100644 --- a/README.md +++ b/README.md @@ -25,6 +25,10 @@ All known missing features and bugs are tracked in [#19](https://github.com/conn `grass` is not a drop-in replacement for `libsass` and does not intend to be. If you are upgrading to `grass` from `libsass`, you may have to make modifications to your stylesheets, though these changes should not differ from those you would have to make if upgrading to `dart-sass`. +## Performance + +`grass` is benchmarked against `dart-sass` and `sassc` (`libsass`) [here](https://github.com/connorskees/sass-perf). In general, `grass` appears to be ~2x faster than `dart-sass` and ~1.7x faster than `sassc`. + ## Web Assembly `grass` experimentally releases a @@ -80,9 +84,9 @@ The spec runner does not work on Windows. Using a modified version of the spec runner that ignores warnings and error spans (but does include error messages), `grass` achieves the following results: ``` -2022-01-07 -PASSING: 6152 -FAILING: 753 +2022-01-16 +PASSING: 6153 +FAILING: 752 TOTAL: 6905 ``` diff --git a/crates/compiler/src/builtin/functions/color/hwb.rs b/crates/compiler/src/builtin/functions/color/hwb.rs index 7269a91..f99b589 100644 --- a/crates/compiler/src/builtin/functions/color/hwb.rs +++ b/crates/compiler/src/builtin/functions/color/hwb.rs @@ -98,7 +98,7 @@ pub(crate) fn hwb(mut args: ArgumentResult, visitor: &mut Visitor) -> SassResult args.span(), )? { ParsedChannels::String(s) => Err(( - format!("Expected numeric channels, got \"{}\"", s), + format!("Expected numeric channels, got \"{}\".", s), args.span(), ) .into()), diff --git a/crates/compiler/src/builtin/modules/meta.rs b/crates/compiler/src/builtin/modules/meta.rs index d30e255..dd7173e 100644 --- a/crates/compiler/src/builtin/modules/meta.rs +++ b/crates/compiler/src/builtin/modules/meta.rs @@ -90,11 +90,9 @@ fn module_functions(mut args: ArgumentResult, visitor: &mut Visitor) -> SassResu ); Ok(Value::Map( - (*(*visitor.env.modules) + (*(*visitor.env.modules).borrow().get(module, args.span())?) .borrow() - .get(module.into(), args.span())?) - .borrow() - .functions(args.span()), + .functions(args.span()), )) } @@ -108,11 +106,9 @@ fn module_variables(mut args: ArgumentResult, visitor: &mut Visitor) -> SassResu ); Ok(Value::Map( - (*(*visitor.env.modules) + (*(*visitor.env.modules).borrow().get(module, args.span())?) .borrow() - .get(module.into(), args.span())?) - .borrow() - .variables(args.span()), + .variables(args.span()), )) } diff --git a/crates/compiler/src/evaluate/visitor.rs b/crates/compiler/src/evaluate/visitor.rs index e9f663d..6d1bb72 100644 --- a/crates/compiler/src/evaluate/visitor.rs +++ b/crates/compiler/src/evaluate/visitor.rs @@ -1161,7 +1161,7 @@ impl<'a> Visitor<'a> { allows_placeholder: bool, span: Span, ) -> SassResult { - let sel_toks = Lexer::new_from_string(&selector_text, span); + let sel_toks = Lexer::new_from_string(selector_text, span); SelectorParser::new(sel_toks, allows_parent, allows_placeholder, span).parse() } diff --git a/crates/compiler/src/parse/stylesheet.rs b/crates/compiler/src/parse/stylesheet.rs index 9a64ada..5439961 100644 --- a/crates/compiler/src/parse/stylesheet.rs +++ b/crates/compiler/src/parse/stylesheet.rs @@ -1534,7 +1534,7 @@ pub(crate) trait StylesheetParser<'a>: BaseParser<'a> + Sized { &base_name[start..end] }; - let mut toks = Lexer::new_from_string(&namespace, url_span); + let mut toks = Lexer::new_from_string(namespace, url_span); // if namespace is empty, avoid attempting to parse an identifier from // an empty string, as there will be no span to emit diff --git a/crates/lib/Cargo.toml b/crates/lib/Cargo.toml index 35a4c64..f46db87 100644 --- a/crates/lib/Cargo.toml +++ b/crates/lib/Cargo.toml @@ -42,9 +42,3 @@ nightly = ["include_sass/nightly"] [dev-dependencies] tempfile = "3.3.0" paste = "1.0.3" - -# [profile.release] -# debug = true -# panic = "abort" -# lto = true -# codegen-units = 1