Skip to content

Commit

Permalink
Merge pull request #772 from heygsc/main
Browse files Browse the repository at this point in the history
use `cow_to_ascii_lowercase` instead
  • Loading branch information
jaytaph authored Jan 13, 2025
2 parents 30387ae + e1d2de3 commit 74fa352
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 1 deletion.
1 change: 1 addition & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
Ahmed Ibrahim <me@ahmedibrahim.dev>
DynamiteC <shethshails@gmail.com>
Emre AYDIN <aeaydin1@gmail.com>
heygsc <1596920983@qq.com>
Joshua Thijssen <jthijssen@noxlogic.nl>
Nicholas Nguyen <nicholas.nguyen@chargeitspot.com>
Niklas Scheerhoorn <sinner1991@gmail.com>
Expand Down
7 changes: 7 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions clippy.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
disallowed-methods = [
{ path = "str::to_ascii_lowercase", reason = "To avoid memory allocation, use `cow_utils::CowUtils::cow_to_ascii_lowercase` instead." },
]
1 change: 1 addition & 0 deletions crates/gosub_css3/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,4 @@ serde = { version = "1.0.217", features = ["derive"] }
serde_json = "1.0.134"
thiserror = "2.0.9"
nom = "7.1.3"
cow-utils = "0.1.3"
3 changes: 2 additions & 1 deletion crates/gosub_css3/src/parser/value.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use crate::node::{Node, NodeType};
use crate::tokenizer::TokenType;
use crate::Css3;
use cow_utils::CowUtils;
use gosub_shared::errors::CssError;
use gosub_shared::errors::CssResult;

Expand Down Expand Up @@ -74,7 +75,7 @@ impl Css3<'_> {
Ok(Some(node))
}
TokenType::Function(name) => {
let node = match name.to_ascii_lowercase().as_str() {
let node = match name.cow_to_ascii_lowercase().as_ref() {
"calc" => self.parse_calc()?,
"url" => {
self.tokenizer.reconsume();
Expand Down

0 comments on commit 74fa352

Please sign in to comment.