summaryrefslogtreecommitdiff
path: root/test_util/src
diff options
context:
space:
mode:
Diffstat (limited to 'test_util/src')
-rw-r--r--test_util/src/lib.rs18
-rw-r--r--test_util/src/lsp.rs8
2 files changed, 10 insertions, 16 deletions
diff --git a/test_util/src/lib.rs b/test_util/src/lib.rs
index 0b6ce1615..6a6614ad0 100644
--- a/test_util/src/lib.rs
+++ b/test_util/src/lib.rs
@@ -13,8 +13,8 @@ use hyper::Body;
use hyper::Request;
use hyper::Response;
use hyper::StatusCode;
-use lazy_static::lazy_static;
use npm::CUSTOM_NPM_PACKAGE_CACHE;
+use once_cell::sync::Lazy;
use pretty_assertions::assert_eq;
use pty::Pty;
use regex::Regex;
@@ -91,10 +91,8 @@ pub const PERMISSION_VARIANTS: [&str; 5] =
["read", "write", "env", "net", "run"];
pub const PERMISSION_DENIED_PATTERN: &str = "PermissionDenied";
-lazy_static! {
- static ref GUARD: Mutex<HttpServerCount> =
- Mutex::new(HttpServerCount::default());
-}
+static GUARD: Lazy<Mutex<HttpServerCount>> =
+ Lazy::new(|| Mutex::new(HttpServerCount::default()));
pub fn env_vars_for_npm_tests_no_sync_download() -> Vec<(String, String)> {
vec![
@@ -2176,12 +2174,10 @@ pub struct WrkOutput {
}
pub fn parse_wrk_output(output: &str) -> WrkOutput {
- lazy_static! {
- static ref REQUESTS_RX: Regex =
- Regex::new(r"Requests/sec:\s+(\d+)").unwrap();
- static ref LATENCY_RX: Regex =
- Regex::new(r"\s+99%(?:\s+(\d+.\d+)([a-z]+))").unwrap();
- }
+ static REQUESTS_RX: Lazy<Regex> =
+ lazy_regex::lazy_regex!(r"Requests/sec:\s+(\d+)");
+ static LATENCY_RX: Lazy<Regex> =
+ lazy_regex::lazy_regex!(r"\s+99%(?:\s+(\d+.\d+)([a-z]+))");
let mut requests = None;
let mut latency = None;
diff --git a/test_util/src/lsp.rs b/test_util/src/lsp.rs
index 786a2dee5..3e9d0a80b 100644
--- a/test_util/src/lsp.rs
+++ b/test_util/src/lsp.rs
@@ -9,7 +9,6 @@ use super::new_deno_dir;
use super::TempDir;
use anyhow::Result;
-use lazy_static::lazy_static;
use lsp_types as lsp;
use lsp_types::ClientCapabilities;
use lsp_types::ClientInfo;
@@ -25,6 +24,7 @@ use lsp_types::TextDocumentClientCapabilities;
use lsp_types::TextDocumentSyncClientCapabilities;
use lsp_types::Url;
use lsp_types::WorkspaceClientCapabilities;
+use once_cell::sync::Lazy;
use parking_lot::Condvar;
use parking_lot::Mutex;
use regex::Regex;
@@ -48,10 +48,8 @@ use std::sync::Arc;
use std::time::Duration;
use std::time::Instant;
-lazy_static! {
- static ref CONTENT_TYPE_REG: Regex =
- Regex::new(r"(?i)^content-length:\s+(\d+)").unwrap();
-}
+static CONTENT_TYPE_REG: Lazy<Regex> =
+ lazy_regex::lazy_regex!(r"(?i)^content-length:\s+(\d+)");
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct LspResponseError {