Skip to content

Commit

Permalink
Merge pull request #266 from taiki-e/once_cell
Browse files Browse the repository at this point in the history
Remove dependency on once_cell
  • Loading branch information
dtolnay authored May 4, 2024
2 parents 5fb7cae + f8795cf commit 62b1543
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 7 deletions.
1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ diff = ["dissimilar"]
[dependencies]
dissimilar = { version = "1.0", optional = true }
glob = "0.3"
once_cell = "1.9"
serde = "1.0.194"
serde_derive = "1.0.194"
serde_json = "1.0.110"
Expand Down
5 changes: 2 additions & 3 deletions src/flock.rs
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
use crate::error::Result;
use once_cell::sync::OnceCell;
use std::fs::{self, File, OpenOptions};
use std::io;
use std::path::{Path, PathBuf};
use std::sync::atomic::{AtomicBool, Ordering};
use std::sync::{Arc, Mutex, MutexGuard, PoisonError};
use std::sync::{Arc, Mutex, MutexGuard, OnceLock, PoisonError};
use std::thread;
use std::time::{Duration, SystemTime};

static LOCK: OnceCell<Mutex<()>> = OnceCell::new();
static LOCK: OnceLock<Mutex<()>> = OnceLock::new();

pub(crate) struct Lock {
intraprocess_guard: Guard,
Expand Down
5 changes: 2 additions & 3 deletions src/term.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
use once_cell::sync::OnceCell;
use std::io::{Result, Write};
use std::sync::{Mutex, MutexGuard, PoisonError};
use std::sync::{Mutex, MutexGuard, OnceLock, PoisonError};
use termcolor::{Color, ColorChoice, ColorSpec, StandardStream as Stream, WriteColor};

static TERM: OnceCell<Mutex<Term>> = OnceCell::new();
static TERM: OnceLock<Mutex<Term>> = OnceLock::new();

pub(crate) fn lock() -> MutexGuard<'static, Term> {
TERM.get_or_init(|| Mutex::new(Term::new()))
Expand Down

0 comments on commit 62b1543

Please sign in to comment.