From bf0d912dc8ce870684f31cc1189b87de236e5e44 Mon Sep 17 00:00:00 2001 From: connorskees Date: Sun, 8 Jan 2023 00:33:39 +0000 Subject: [PATCH] clippy --- crates/compiler/Cargo.toml | 9 +++++++-- crates/compiler/src/evaluate/visitor.rs | 8 +++----- crates/compiler/src/serializer.rs | 10 +++++----- crates/include_sass/Cargo.toml | 8 ++++++++ crates/include_sass/src/lib.rs | 5 +---- crates/lib/Cargo.toml | 2 +- crates/lib/src/lib.rs | 2 +- 7 files changed, 26 insertions(+), 18 deletions(-) diff --git a/crates/compiler/Cargo.toml b/crates/compiler/Cargo.toml index 05098ad..893b7b4 100644 --- a/crates/compiler/Cargo.toml +++ b/crates/compiler/Cargo.toml @@ -2,8 +2,13 @@ name = "compiler" version = "0.12.1" edition = "2021" - -# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html +description = "Internal implementation of the grass compiler" +readme = "../README.md" +license = "MIT" +categories = ["web-programming"] +keywords = ["scss", "sass", "css", "web"] +repository = "https://github.com/connorskees/grass" +authors = ["Connor Skees <39542938+ConnorSkees@users.noreply.github.com>"] [lib] name = "compiler" diff --git a/crates/compiler/src/evaluate/visitor.rs b/crates/compiler/src/evaluate/visitor.rs index dafbc96..9f7b9e2 100644 --- a/crates/compiler/src/evaluate/visitor.rs +++ b/crates/compiler/src/evaluate/visitor.rs @@ -2286,7 +2286,7 @@ impl<'a> Visitor<'a> { args.positional .into_iter() - .map(|arg| Ok(arg.to_css_string(span, self.options.is_compressed())?)) + .map(|arg| arg.to_css_string(span, self.options.is_compressed())) .collect::>>()? } }; @@ -2389,7 +2389,7 @@ impl<'a> Visitor<'a> { buffer.push_str(&evaluated); } - if let Some(rest_arg) = args.rest.clone() { + if let Some(rest_arg) = args.rest { let rest = self.visit_expr(rest_arg)?; if !first { buffer.push_str(", "); @@ -2749,9 +2749,7 @@ impl<'a> Visitor<'a> { // ); } - let result = div(left, right, self.options, span)?; - - result + div(left, right, self.options, span)? } BinaryOp::Rem => { let right = self.visit_expr(rhs)?; diff --git a/crates/compiler/src/serializer.rs b/crates/compiler/src/serializer.rs index 2bb8768..eccd3c4 100644 --- a/crates/compiler/src/serializer.rs +++ b/crates/compiler/src/serializer.rs @@ -721,7 +721,7 @@ impl<'a> Serializer<'a> { while let Some(elem) = elems.next() { if self.inspect { - let needs_parens = Self::elem_needs_parens(sep, &elem); + let needs_parens = Self::elem_needs_parens(sep, elem); if needs_parens { self.buffer.push(b'('); } @@ -923,9 +923,9 @@ impl<'a> Serializer<'a> { fn visit_value(&mut self, value: &Value, span: Span) -> SassResult<()> { match value { - Value::Dimension(num) => self.visit_number(&num)?, - Value::Color(color) => self.visit_color(&color), - Value::Calculation(calc) => self.visit_calculation(&calc)?, + Value::Dimension(num) => self.visit_number(num)?, + Value::Color(color) => self.visit_color(color), + Value::Calculation(calc) => self.visit_calculation(calc)?, Value::List(elems, sep, brackets) => self.visit_list(elems, *sep, *brackets, span)?, Value::True => self.buffer.extend_from_slice(b"true"), Value::False => self.buffer.extend_from_slice(b"false"), @@ -935,7 +935,7 @@ impl<'a> Serializer<'a> { } } Value::Map(map) => self.visit_map(map, span)?, - Value::FunctionRef(func) => self.visit_function_ref(&*func, span)?, + Value::FunctionRef(func) => self.visit_function_ref(func, span)?, Value::String(s, QuoteKind::Quoted) => self.visit_quoted_string(false, s), Value::String(s, QuoteKind::None) => self.visit_unquoted_string(s), Value::ArgList(arglist) => self.visit_arglist(arglist, span)?, diff --git a/crates/include_sass/Cargo.toml b/crates/include_sass/Cargo.toml index 69c89a8..dfb5835 100644 --- a/crates/include_sass/Cargo.toml +++ b/crates/include_sass/Cargo.toml @@ -2,6 +2,14 @@ name = "include_sass" version = "0.12.1" edition = "2021" +description = "Internal implementation of the grass::include! macro" +readme = "../README.md" +license = "MIT" +categories = ["web-programming"] +keywords = ["scss", "sass", "css", "web"] +repository = "https://github.com/connorskees/grass" +authors = ["Connor Skees <39542938+ConnorSkees@users.noreply.github.com>"] +include = ["src", "Cargo.toml", "../README.md", "../CHANGELOG.md", "../LICENSE"] [lib] proc-macro = true diff --git a/crates/include_sass/src/lib.rs b/crates/include_sass/src/lib.rs index 7274b95..da8d08d 100644 --- a/crates/include_sass/src/lib.rs +++ b/crates/include_sass/src/lib.rs @@ -103,10 +103,7 @@ pub fn include_sass(item: TokenStream) -> TokenStream { ) { Ok(css) => css, Err(e) => { - let err = syn::Error::new( - input.span(), - format!("Failed to compile Sass\n{}", e.to_string()), - ); + let err = syn::Error::new(input.span(), format!("Failed to compile Sass\n{}", e)); return syn::Error::into_compile_error(err).into(); } }; diff --git a/crates/lib/Cargo.toml b/crates/lib/Cargo.toml index 2376d7f..baa62ee 100644 --- a/crates/lib/Cargo.toml +++ b/crates/lib/Cargo.toml @@ -7,7 +7,7 @@ license = "MIT" categories = ["command-line-utilities", "web-programming"] keywords = ["scss", "sass", "css", "web"] repository = "https://github.com/connorskees/grass" -authors = ["ConnorSkees <39542938+ConnorSkees@users.noreply.github.com>"] +authors = ["Connor Skees <39542938+ConnorSkees@users.noreply.github.com>"] edition = "2021" include = ["src", "Cargo.toml", "README.md", "CHANGELOG.md", "Cargo.lock", "LICENSE"] default-run = "grass" diff --git a/crates/lib/src/lib.rs b/crates/lib/src/lib.rs index 130cdf1..a935b14 100644 --- a/crates/lib/src/lib.rs +++ b/crates/lib/src/lib.rs @@ -85,7 +85,7 @@ pub use compiler::*; /// Include CSS in your binary at compile time from a Sass source file /// /// ``` -/// static CSS: &str = grass::include!("../static/_main.scss"); +/// static CSS: &str = grass::include!("../static/_index.scss"); /// ``` /// /// This requires the `"macro"` feature, which is not enabled by default.