Skip to content

Commit

Permalink
Use cow_to_ascii_uppercase instead (#4124)
Browse files Browse the repository at this point in the history
* Use  instead

* chore: clippy.toml

Co-authored-by: José Julián Espina <[email protected]>

---------

Co-authored-by: José Julián Espina <[email protected]>
  • Loading branch information
heygsc and jedel1043 authored Jan 14, 2025
1 parent efcafda commit 3008f1d
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 2 deletions.
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.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ arbitrary = "1"
bitflags = "2.5.0"
clap = "4.5.23"
colored = "2.2.0"
cow-utils = "0.1.3"
fast-float2 = "0.2.3"
hashbrown = "0.15.2"
indexmap = { version = "2.7.0", default-features = false }
Expand Down
3 changes: 3 additions & 0 deletions clippy.toml
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
doc-valid-idents = ['ECMAScript', 'JavaScript', 'SpiderMonkey', 'GitHub']
allow-print-in-tests = true
disallowed-methods = [
{ path = "str::to_ascii_uppercase", reason = "To avoid memory allocation, use `cow_utils::CowUtils::cow_to_ascii_uppercase` instead." },
]
1 change: 1 addition & 0 deletions core/engine/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ boa_macros.workspace = true
boa_ast.workspace = true
boa_parser.workspace = true
boa_string.workspace = true
cow-utils.workspace = true
serde = { workspace = true, features = ["derive", "rc"] }
serde_json.workspace = true
rand.workspace = true
Expand Down
4 changes: 2 additions & 2 deletions core/engine/src/builtins/temporal/time_zone/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#![allow(dead_code)]

use crate::{builtins::temporal::to_zero_padded_decimal_string, Context};

use cow_utils::CowUtils;
// -- TimeZone Abstract Operations --

/// Abstract operation `DefaultTimeZone ( )`
Expand Down Expand Up @@ -96,7 +96,7 @@ fn canonicalize_time_zone_name(time_zone: &str) -> String {
// do not include local political rules for any time zones performs the following steps when
// called:
// 1. Assert: timeZone is an ASCII-case-insensitive match for "UTC".
assert_eq!(time_zone.to_ascii_uppercase(), "UTC");
assert_eq!(time_zone.cow_to_ascii_uppercase(), "UTC");
// 2. Return "UTC".
"UTC".to_owned()
}

0 comments on commit 3008f1d

Please sign in to comment.