Replace once_cell with std's recently stabilized OnceCell/Lock and LazyCell/Lock

This doesn't get rid of the once_cell dependency, unfortunately, since we have dependencies that use it, but it's a nice to do cleanup. And when our deps will eventually get rid of once_cell we will get rid of it for free.
This commit is contained in:
Chayim Refael Friedman 2024-08-16 09:53:37 +03:00
parent 0daeb5c0b0
commit 955e609867
19 changed files with 49 additions and 54 deletions

View file

@ -2,6 +2,8 @@
//!
//! This module uses a bit of static metadata to provide completions for builtin-in attributes and lints.
use std::sync::LazyLock;
use ide_db::{
generated::lints::{
Lint, CLIPPY_LINTS, CLIPPY_LINT_GROUPS, DEFAULT_LINTS, FEATURES, RUSTDOC_LINTS,
@ -10,7 +12,6 @@ use ide_db::{
FxHashMap, SymbolKind,
};
use itertools::Itertools;
use once_cell::sync::Lazy;
use syntax::{
ast::{self, AttrKind},
AstNode, SyntaxKind, T,
@ -215,7 +216,7 @@ macro_rules! attrs {
}
#[rustfmt::skip]
static KIND_TO_ATTRIBUTES: Lazy<FxHashMap<SyntaxKind, &[&str]>> = Lazy::new(|| {
static KIND_TO_ATTRIBUTES: LazyLock<FxHashMap<SyntaxKind, &[&str]>> = LazyLock::new(|| {
use SyntaxKind::*;
[
(