diff --git a/.clippy.toml b/.clippy.toml index c4ffc9fedb04c..18a0450382296 100644 --- a/.clippy.toml +++ b/.clippy.toml @@ -8,3 +8,7 @@ disallowed-methods = [ { path = "str::replace", reason = "To avoid memory allocation, use `cow_utils::CowUtils::cow_replace` instead." }, { path = "str::replacen", reason = "To avoid memory allocation, use `cow_utils::CowUtils::cow_replacen` instead." }, ] + +disallowed-types = [ + { path = "std::collections::HashMap", reason = "Use `rustc_hash::FxHashMap` instead, which is typically faster." }, +] diff --git a/crates/oxc_language_server/src/main.rs b/crates/oxc_language_server/src/main.rs index 86d56db2483c9..f55dd1342c66a 100644 --- a/crates/oxc_language_server/src/main.rs +++ b/crates/oxc_language_server/src/main.rs @@ -1,7 +1,6 @@ -#[allow(clippy::disallowed_types)] mod linter; -use std::{collections::HashMap, fmt::Debug, path::PathBuf, str::FromStr}; +use std::{fmt::Debug, path::PathBuf, str::FromStr}; use dashmap::DashMap; use futures::future::join_all; @@ -254,7 +253,8 @@ impl LanguageServer for Backend { kind: Some(CodeActionKind::QUICKFIX), is_preferred: Some(true), edit: Some(WorkspaceEdit { - changes: Some(HashMap::from([( + #[expect(clippy::disallowed_types)] + changes: Some(std::collections::HashMap::from([( uri, vec![TextEdit { range: fixed_content.range,