Less once_cell more std

This commit is contained in:
Lukas Wirth 2023-09-01 17:30:59 +02:00
parent 62268e474e
commit c09f175d59
7 changed files with 14 additions and 15 deletions

View file

@ -8,7 +8,8 @@
//! name resolution, and `BUILTIN_ATTRIBUTES` is almost entirely unchanged from the original, to
//! ease updating.
use once_cell::sync::OnceCell;
use std::sync::OnceLock;
use rustc_hash::FxHashMap;
/// Ignored attribute namespaces used by tools.
@ -29,7 +30,7 @@ pub struct AttributeTemplate {
}
pub fn find_builtin_attr_idx(name: &str) -> Option<usize> {
static BUILTIN_LOOKUP_TABLE: OnceCell<FxHashMap<&'static str, usize>> = OnceCell::new();
static BUILTIN_LOOKUP_TABLE: OnceLock<FxHashMap<&'static str, usize>> = OnceLock::new();
BUILTIN_LOOKUP_TABLE
.get_or_init(|| {
INERT_ATTRIBUTES.iter().map(|attr| attr.name).enumerate().map(|(a, b)| (b, a)).collect()

View file

@ -1,10 +1,11 @@
//! Context for lowering paths.
use std::cell::OnceCell;
use hir_expand::{
ast_id_map::{AstIdMap, AstIdNode},
hygiene::Hygiene,
AstId, HirFileId, InFile,
};
use once_cell::unsync::OnceCell;
use syntax::ast;
use triomphe::Arc;