Replace once_cell with types from the standard library.
This commit is contained in:
parent
3a885d8dbf
commit
4ed3d371e5
1
Cargo.lock
generated
1
Cargo.lock
generated
@ -3135,7 +3135,6 @@ dependencies = [
|
||||
"fehler",
|
||||
"is-terminal",
|
||||
"itertools 0.12.0",
|
||||
"once_cell",
|
||||
"predicates",
|
||||
"roff",
|
||||
"rpassword",
|
||||
|
@ -40,7 +40,6 @@ anyhow = "1.0.18"
|
||||
chrono = "0.4.10"
|
||||
clap = { version = "4", features = ["derive", "env", "string", "wrap_help"] }
|
||||
itertools = ">=0.10, <0.13"
|
||||
once_cell = "1.17"
|
||||
sequoia-cert-store = "0.4"
|
||||
sequoia-wot = "0.9"
|
||||
tempfile = "3.1"
|
||||
|
11
src/sq.rs
11
src/sq.rs
@ -10,6 +10,7 @@ use anyhow::Context as _;
|
||||
use is_terminal::IsTerminal;
|
||||
|
||||
use std::borrow::Borrow;
|
||||
use std::cell::OnceCell;
|
||||
use std::collections::btree_map::{BTreeMap, Entry};
|
||||
use std::fmt;
|
||||
use std::io;
|
||||
@ -18,7 +19,6 @@ use std::path::{Path, PathBuf};
|
||||
use std::str::FromStr;
|
||||
use std::time::{Duration, SystemTime};
|
||||
use std::sync::Arc;
|
||||
use once_cell::unsync::OnceCell;
|
||||
|
||||
use sequoia_openpgp as openpgp;
|
||||
|
||||
@ -233,11 +233,10 @@ where
|
||||
primary_uid = Some(primary.userid());
|
||||
} else {
|
||||
// Special case, there is no user id.
|
||||
use once_cell::sync::Lazy;
|
||||
static FALLBACK: Lazy<UserID> = Lazy::new(|| {
|
||||
UserID::from("<unknown>")
|
||||
});
|
||||
primary_uid = Some(&FALLBACK);
|
||||
use std::sync::OnceLock;
|
||||
static FALLBACK: OnceLock<UserID> = OnceLock::new();
|
||||
primary_uid =
|
||||
Some(FALLBACK.get_or_init(|| UserID::from("<unknown>")));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,11 +1,10 @@
|
||||
use std::path::Path;
|
||||
use std::process::ExitStatus;
|
||||
use std::sync::Mutex;
|
||||
use std::sync::{Mutex, OnceLock};
|
||||
|
||||
use tempfile::TempDir;
|
||||
use assert_cmd::Command;
|
||||
|
||||
use once_cell::sync::OnceCell;
|
||||
|
||||
use sequoia_openpgp as openpgp;
|
||||
use openpgp::Result;
|
||||
@ -24,7 +23,7 @@ fn artifact(filename: &str) -> String {
|
||||
//
|
||||
// This function drives the clock forward, and ensures that every
|
||||
// operation "happens" at a different point in time.
|
||||
static TIME: OnceCell<Mutex<chrono::DateTime<chrono::Utc>>> = OnceCell::new();
|
||||
static TIME: OnceLock<Mutex<chrono::DateTime<chrono::Utc>>> = OnceLock::new();
|
||||
|
||||
fn tick() -> String {
|
||||
let t = TIME.get_or_init(|| Mutex::new(chrono::Utc::now()));
|
||||
|
Loading…
x
Reference in New Issue
Block a user