diff --git a/crates/oxc_linter/src/rules/eslint/no_bitwise.rs b/crates/oxc_linter/src/rules/eslint/no_bitwise.rs index d92a5a5742d40..59db49cd73836 100644 --- a/crates/oxc_linter/src/rules/eslint/no_bitwise.rs +++ b/crates/oxc_linter/src/rules/eslint/no_bitwise.rs @@ -1,7 +1,7 @@ use oxc_ast::AstKind; use oxc_diagnostics::OxcDiagnostic; use oxc_macros::declare_oxc_lint; -use oxc_span::Span; +use oxc_span::{CompactStr, Span}; use oxc_syntax::operator::BinaryOperator; use crate::{context::LintContext, rule::Rule, AstNode}; @@ -17,7 +17,7 @@ pub struct NoBitwise(Box); #[derive(Debug, Default, Clone)] pub struct NoBitwiseConfig { - allow: Vec, + allow: Vec, int32_hint: bool, } @@ -57,10 +57,7 @@ impl Rule for NoBitwise { .and_then(|v| v.get("allow")) .and_then(serde_json::Value::as_array) .map(|v| { - v.iter() - .filter_map(serde_json::Value::as_str) - .map(ToString::to_string) - .collect() + v.iter().filter_map(serde_json::Value::as_str).map(CompactStr::from).collect() }) .unwrap_or_default(), int32_hint: obj @@ -107,7 +104,7 @@ impl Rule for NoBitwise { } } -fn allowed_operator(allow: &[String], operator: &str) -> bool { +fn allowed_operator(allow: &[CompactStr], operator: &str) -> bool { allow.iter().any(|s| s == operator) }