diff --git a/Cargo.lock b/Cargo.lock index ca0490c465870..8e2aaeabd1925 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1541,7 +1541,6 @@ dependencies = [ "daachorse", "insta", "nonmax", - "once_cell", "oxc_allocator", "oxc_ast", "oxc_index", @@ -1667,7 +1666,6 @@ dependencies = [ "markdown", "memchr", "mime_guess", - "once_cell", "oxc_allocator", "oxc_ast", "oxc_cfg", diff --git a/Cargo.toml b/Cargo.toml index 99713a028c9b7..90a38b144b56b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -146,7 +146,6 @@ mime_guess = "2.0.5" nonmax = "0.5.5" num-bigint = "0.4.6" num-traits = "0.2.19" -once_cell = "1.19.0" ouroboros = "0.18.4" owo-colors = "4.0.0" oxc_resolver = "1.10.2" diff --git a/crates/oxc_codegen/Cargo.toml b/crates/oxc_codegen/Cargo.toml index 2704cc2c7c042..9f1addc034e9b 100644 --- a/crates/oxc_codegen/Cargo.toml +++ b/crates/oxc_codegen/Cargo.toml @@ -30,7 +30,6 @@ oxc_index = { workspace = true } bitflags = { workspace = true } nonmax = { workspace = true } -once_cell = { workspace = true } daachorse = { workspace = true } rustc-hash = { workspace = true } diff --git a/crates/oxc_codegen/src/annotation_comment.rs b/crates/oxc_codegen/src/annotation_comment.rs index 2b16cc7f11931..76091ceb756ef 100644 --- a/crates/oxc_codegen/src/annotation_comment.rs +++ b/crates/oxc_codegen/src/annotation_comment.rs @@ -1,10 +1,10 @@ use daachorse::DoubleArrayAhoCorasick; -use once_cell::sync::Lazy; use oxc_ast::{Comment, CommentKind}; use oxc_span::Span; +use std::sync::LazyLock; use crate::Codegen; -static MATCHER: Lazy> = Lazy::new(|| { +static MATCHER: LazyLock> = LazyLock::new(|| { let patterns = vec!["#__NO_SIDE_EFFECTS__", "@__NO_SIDE_EFFECTS__", "@__PURE__", "#__PURE__"]; DoubleArrayAhoCorasick::new(patterns).unwrap() diff --git a/crates/oxc_linter/Cargo.toml b/crates/oxc_linter/Cargo.toml index 827d342431604..f9f5d79e9c7d8 100644 --- a/crates/oxc_linter/Cargo.toml +++ b/crates/oxc_linter/Cargo.toml @@ -48,7 +48,6 @@ language-tags = { workspace = true } mime_guess = { workspace = true } url = { workspace = true } rust-lapper = { workspace = true } -once_cell = { workspace = true } memchr = { workspace = true } json-strip-comments = { workspace = true } schemars = { workspace = true, features = ["indexmap2"] } diff --git a/crates/oxc_linter/src/rules/jsx_a11y/prefer_tag_over_role.rs b/crates/oxc_linter/src/rules/jsx_a11y/prefer_tag_over_role.rs index e6bee0de19088..18aadf269729e 100644 --- a/crates/oxc_linter/src/rules/jsx_a11y/prefer_tag_over_role.rs +++ b/crates/oxc_linter/src/rules/jsx_a11y/prefer_tag_over_role.rs @@ -1,4 +1,3 @@ -use once_cell::sync::Lazy; use oxc_ast::{ ast::{JSXAttributeItem, JSXAttributeValue}, AstKind, @@ -7,6 +6,7 @@ use oxc_diagnostics::OxcDiagnostic; use oxc_macros::declare_oxc_lint; use oxc_span::Span; use phf::phf_map; +use std::sync::LazyLock; use crate::{ context::LintContext, @@ -75,7 +75,7 @@ impl PreferTagOverRole { } } -static ROLE_TO_TAG_MAP: Lazy> = Lazy::new(|| { +static ROLE_TO_TAG_MAP: LazyLock> = LazyLock::new(|| { phf_map! { "checkbox" => "input", "button" => "button", diff --git a/crates/oxc_linter/src/rules/react/no_unknown_property.rs b/crates/oxc_linter/src/rules/react/no_unknown_property.rs index ca9d429419bc6..3b8876f2b0c10 100644 --- a/crates/oxc_linter/src/rules/react/no_unknown_property.rs +++ b/crates/oxc_linter/src/rules/react/no_unknown_property.rs @@ -1,7 +1,6 @@ use std::{borrow::Cow, collections::hash_map::HashMap}; use itertools::Itertools; -use once_cell::sync::Lazy; use oxc_ast::{ ast::{JSXAttributeItem, JSXAttributeName, JSXElementName}, AstKind, @@ -13,6 +12,7 @@ use phf::{phf_map, phf_set, Map, Set}; use regex::Regex; use rustc_hash::FxHashSet; use serde::Deserialize; +use std::sync::LazyLock; use crate::{context::LintContext, rule::Rule, utils::get_jsx_attribute_name, AstNode}; @@ -419,7 +419,7 @@ const DOM_PROPERTIES_IGNORE_CASE: [&str; 5] = [ "webkitDirectory", ]; -static DOM_PROPERTIES_LOWER_MAP: Lazy> = Lazy::new(|| { +static DOM_PROPERTIES_LOWER_MAP: LazyLock> = LazyLock::new(|| { DOM_PROPERTIES_NAMES.iter().map(|it| (it.to_lowercase(), *it)).collect::>() }); @@ -430,7 +430,8 @@ static DOM_PROPERTIES_LOWER_MAP: Lazy> = Lazy::new /// then the attribute is a valid data attribute. /// fn is_valid_data_attr(name: &str) -> bool { - static DATA_ATTR_REGEX: Lazy = Lazy::new(|| Regex::new(r"^data(-?[^:]*)$").unwrap()); + static DATA_ATTR_REGEX: LazyLock = + LazyLock::new(|| Regex::new(r"^data(-?[^:]*)$").unwrap()); !name.to_lowercase().starts_with("data-xml") && DATA_ATTR_REGEX.is_match(name) } @@ -455,7 +456,8 @@ impl Rule for NoUnknownProperty { } fn run<'a>(&self, node: &AstNode<'a>, ctx: &LintContext<'a>) { - static HTML_TAG_CONVENTION: Lazy = Lazy::new(|| Regex::new("^[a-z][^-]*$").unwrap()); + static HTML_TAG_CONVENTION: LazyLock = + LazyLock::new(|| Regex::new("^[a-z][^-]*$").unwrap()); let AstKind::JSXOpeningElement(el) = &node.kind() else { return;