Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions .clippy.toml
Original file line number Diff line number Diff line change
@@ -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." },
]
4 changes: 1 addition & 3 deletions crates/oxc_linter/src/rules/unicorn/prefer_spread.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
1 change: 1 addition & 0 deletions tasks/ast_tools/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#![allow(clippy::disallowed_methods)]
use std::{cell::RefCell, io::Read, path::PathBuf, rc::Rc};

use bpaf::{Bpaf, Parser};
Expand Down
1 change: 1 addition & 0 deletions tasks/benchmark/benches/lexer.rs
Original file line number Diff line number Diff line change
@@ -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};
Expand Down
2 changes: 1 addition & 1 deletion tasks/common/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#![allow(clippy::print_stdout)]
#![allow(clippy::print_stdout, clippy::disallowed_methods)]
use std::path::{Path, PathBuf};

mod diff;
Expand Down
2 changes: 1 addition & 1 deletion tasks/coverage/src/lib.rs
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
2 changes: 1 addition & 1 deletion tasks/prettier_conformance/src/lib.rs
Original file line number Diff line number Diff line change
@@ -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;

Expand Down
2 changes: 1 addition & 1 deletion tasks/rulegen/src/main.rs
Original file line number Diff line number Diff line change
@@ -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,
Expand Down
7 changes: 6 additions & 1 deletion tasks/website/src/lib.rs
Original file line number Diff line number Diff line change
@@ -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;