diff --git a/.clippy.toml b/.clippy.toml index 281aac36299b8..ec32d7f271626 100644 --- a/.clippy.toml +++ b/.clippy.toml @@ -1,6 +1,10 @@ ignore-interior-mutability = ["oxc_linter::rule::RuleWithSeverity"] disallowed-methods = [ - { path = "str::to_ascii_lowercase", reason = "Avoid memory allocation. Use `cow_utils::CowUtils::cow_to_ascii_lowercase` instead." }, - { path = "str::to_ascii_uppercase", reason = "Avoid memory allocation. Use `cow_utils::CowUtils::cow_to_ascii_uppercase` instead." }, + { path = "str::to_ascii_lowercase", reason = "To avoid memory allocation, use `cow_utils::CowUtils::cow_to_ascii_lowercase` instead." }, + { path = "str::to_ascii_uppercase", reason = "To avoid memory allocation, use `cow_utils::CowUtils::cow_to_ascii_uppercase` instead." }, + { path = "str::to_lowercase", reason = "To avoid memory allocation, use `cow_utils::CowUtils::cow_to_lowercase` instead." }, + { path = "str::to_uppercase", reason = "To avoid memory allocation, use `cow_utils::CowUtils::cow_to_uppercase` instead." }, + { path = "str::replace", reason = "To avoid memory allocation, use `cow_utils::CowUtils::replace` instead." }, + { path = "str::replacen", reason = "To avoid memory allocation, use `cow_utils::CowUtils::replacen` instead." }, ] diff --git a/crates/oxc_linter/src/rules/unicorn/prefer_spread.rs b/crates/oxc_linter/src/rules/unicorn/prefer_spread.rs index aa000fa7ca2e4..8ec927a710669 100644 --- a/crates/oxc_linter/src/rules/unicorn/prefer_spread.rs +++ b/crates/oxc_linter/src/rules/unicorn/prefer_spread.rs @@ -232,9 +232,7 @@ fn is_not_array(expr: &Expression, ctx: &LintContext) -> bool { _ => return false, }; - if ident.starts_with(|c: char| c.is_ascii_uppercase()) - && ident.cow_to_ascii_uppercase() != ident - { + if ident.cow_to_ascii_uppercase() != ident { return true; } diff --git a/tasks/ast_tools/src/main.rs b/tasks/ast_tools/src/main.rs index 2bbc84f2e0b77..6e8dcf94ed346 100644 --- a/tasks/ast_tools/src/main.rs +++ b/tasks/ast_tools/src/main.rs @@ -1,3 +1,4 @@ +#![allow(clippy::disallowed_methods)] use std::{cell::RefCell, io::Read, path::PathBuf, rc::Rc}; use bpaf::{Bpaf, Parser}; diff --git a/tasks/benchmark/benches/lexer.rs b/tasks/benchmark/benches/lexer.rs index 7a95125f6c461..e0aebdefdcf17 100644 --- a/tasks/benchmark/benches/lexer.rs +++ b/tasks/benchmark/benches/lexer.rs @@ -1,3 +1,4 @@ +#![allow(clippy::disallowed_methods)] use oxc_allocator::Allocator; use oxc_benchmark::{criterion_group, criterion_main, BenchmarkId, Criterion}; use oxc_parser::lexer::{Kind, Lexer}; diff --git a/tasks/common/src/lib.rs b/tasks/common/src/lib.rs index cf0d48b460394..530494b0ca685 100644 --- a/tasks/common/src/lib.rs +++ b/tasks/common/src/lib.rs @@ -1,4 +1,4 @@ -#![allow(clippy::print_stdout)] +#![allow(clippy::print_stdout, clippy::disallowed_methods)] use std::path::{Path, PathBuf}; mod diff; diff --git a/tasks/coverage/src/lib.rs b/tasks/coverage/src/lib.rs index 35ecdda830dd2..56eced1bd9934 100644 --- a/tasks/coverage/src/lib.rs +++ b/tasks/coverage/src/lib.rs @@ -1,4 +1,4 @@ -#![allow(clippy::print_stdout, clippy::print_stderr)] +#![allow(clippy::print_stdout, clippy::print_stderr, clippy::disallowed_methods)] // Core mod runtime; mod suite; diff --git a/tasks/prettier_conformance/src/lib.rs b/tasks/prettier_conformance/src/lib.rs index c5fe9710eea66..9dc0009fc4732 100644 --- a/tasks/prettier_conformance/src/lib.rs +++ b/tasks/prettier_conformance/src/lib.rs @@ -1,4 +1,4 @@ -#![allow(clippy::print_stdout, clippy::print_stderr)] +#![allow(clippy::print_stdout, clippy::print_stderr, clippy::disallowed_methods)] mod ignore_list; mod spec; diff --git a/tasks/rulegen/src/main.rs b/tasks/rulegen/src/main.rs index 2a0bc4fb47f31..1a5b5641b2a3d 100644 --- a/tasks/rulegen/src/main.rs +++ b/tasks/rulegen/src/main.rs @@ -1,4 +1,4 @@ -#![allow(clippy::print_stdout, clippy::print_stderr)] +#![allow(clippy::print_stdout, clippy::print_stderr, clippy::disallowed_methods)] use std::{ borrow::Cow, collections::HashMap, diff --git a/tasks/website/src/lib.rs b/tasks/website/src/lib.rs index 505bfc1460852..18887d6521068 100644 --- a/tasks/website/src/lib.rs +++ b/tasks/website/src/lib.rs @@ -1,3 +1,8 @@ -#![allow(clippy::print_stdout, clippy::print_stderr, clippy::missing_panics_doc)] +#![allow( + clippy::print_stdout, + clippy::print_stderr, + clippy::missing_panics_doc, + clippy::disallowed_methods +)] pub mod linter;