mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-29 10:58:02 +00:00
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:
parent
0daeb5c0b0
commit
955e609867
19 changed files with 49 additions and 54 deletions
|
|
@ -11,6 +11,7 @@ mod simple;
|
|||
mod traits;
|
||||
|
||||
use std::env;
|
||||
use std::sync::LazyLock;
|
||||
|
||||
use base_db::SourceDatabaseFileInputExt as _;
|
||||
use expect_test::Expect;
|
||||
|
|
@ -24,7 +25,6 @@ use hir_def::{
|
|||
AssocItemId, DefWithBodyId, HasModule, LocalModuleId, Lookup, ModuleDefId,
|
||||
};
|
||||
use hir_expand::{db::ExpandDatabase, FileRange, InFile};
|
||||
use once_cell::race::OnceBool;
|
||||
use rustc_hash::FxHashMap;
|
||||
use stdx::format_to;
|
||||
use syntax::{
|
||||
|
|
@ -49,8 +49,8 @@ use crate::{
|
|||
// `env UPDATE_EXPECT=1 cargo test -p hir_ty` to update the snapshots.
|
||||
|
||||
fn setup_tracing() -> Option<tracing::subscriber::DefaultGuard> {
|
||||
static ENABLE: OnceBool = OnceBool::new();
|
||||
if !ENABLE.get_or_init(|| env::var("CHALK_DEBUG").is_ok()) {
|
||||
static ENABLE: LazyLock<bool> = LazyLock::new(|| env::var("CHALK_DEBUG").is_ok());
|
||||
if !*ENABLE {
|
||||
return None;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue