summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorAbdul-Rahman Sibahi <asibahi@users.noreply.github.com>2024-10-31 14:52:11 +0300
committerGitHub <noreply@github.com>2024-10-31 11:52:11 +0000
commitb969c01b282287b44c3e131f8c0c53dcbb304e30 (patch)
treefe58484bfa76e7fe7a35bf0bffdc339b24621693 /tests
parent644ed252dda1a0785d2bee577a89322416f4d950 (diff)
Replace `once_cell`'s `Lazy` as much as possible (#4617)
Co-authored-by: Laurenz <laurmaedje@gmail.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/Cargo.toml1
-rw-r--r--tests/src/collect.rs4
-rw-r--r--tests/src/tests.rs4
3 files changed, 4 insertions, 5 deletions
diff --git a/tests/Cargo.toml b/tests/Cargo.toml
index b2fedd75..b1855b49 100644
--- a/tests/Cargo.toml
+++ b/tests/Cargo.toml
@@ -22,7 +22,6 @@ typst-svg = { workspace = true }
clap = { workspace = true }
comemo = { workspace = true }
ecow = { workspace = true }
-once_cell = { workspace = true }
oxipng = { workspace = true }
parking_lot = { workspace = true }
rayon = { workspace = true }
diff --git a/tests/src/collect.rs b/tests/src/collect.rs
index cc3ff736..80e5e5a8 100644
--- a/tests/src/collect.rs
+++ b/tests/src/collect.rs
@@ -3,9 +3,9 @@ use std::fmt::{self, Display, Formatter};
use std::ops::Range;
use std::path::{Path, PathBuf};
use std::str::FromStr;
+use std::sync::LazyLock;
use ecow::{eco_format, EcoString};
-use once_cell::sync::Lazy;
use typst::syntax::package::PackageVersion;
use typst::syntax::{is_id_continue, is_ident, is_newline, FileId, Source, VirtualPath};
use unscanny::Scanner;
@@ -390,7 +390,7 @@ impl<'a> Parser<'a> {
/// Whether a test is within the selected set to run.
fn selected(name: &str, abs: PathBuf) -> bool {
- static SKIPPED: Lazy<HashSet<&'static str>> = Lazy::new(|| {
+ static SKIPPED: LazyLock<HashSet<&'static str>> = LazyLock::new(|| {
String::leak(std::fs::read_to_string(crate::SKIP_PATH).unwrap())
.lines()
.map(|line| line.trim())
diff --git a/tests/src/tests.rs b/tests/src/tests.rs
index 58bd7cf7..940c9e3c 100644
--- a/tests/src/tests.rs
+++ b/tests/src/tests.rs
@@ -8,10 +8,10 @@ mod run;
mod world;
use std::path::Path;
+use std::sync::LazyLock;
use std::time::Duration;
use clap::Parser;
-use once_cell::sync::Lazy;
use parking_lot::Mutex;
use rayon::iter::{ParallelBridge, ParallelIterator};
@@ -19,7 +19,7 @@ use crate::args::{CliArguments, Command};
use crate::logger::Logger;
/// The parsed command line arguments.
-static ARGS: Lazy<CliArguments> = Lazy::new(CliArguments::parse);
+static ARGS: LazyLock<CliArguments> = LazyLock::new(CliArguments::parse);
/// The directory where the test suite is located.
const SUITE_PATH: &str = "tests/suite";