diff options
| author | Yiyu Lin <linyiyu1992@gmail.com> | 2023-04-13 09:08:01 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-04-13 03:08:01 +0200 |
| commit | d790ea7d533c3c48b09a2f16f3fef549aa96be78 (patch) | |
| tree | b31fc35baf1f634054f52e94626f0399d187b99b /test_util/src/lsp.rs | |
| parent | 19c3e4f6dc31fd78e2793d0596d6a9cc3a30580a (diff) | |
refactor(cli,ext,ops): cleanup `regex` with `lazy-regex` (#17296)
- bump deps: the newest `lazy-regex` need newer `oncecell` and
`regex`
- reduce `unwrap`
- remove dep `lazy_static`
- make more regex cached
---------
Co-authored-by: Bartek IwaĆczuk <biwanczuk@gmail.com>
Diffstat (limited to 'test_util/src/lsp.rs')
| -rw-r--r-- | test_util/src/lsp.rs | 8 |
1 files changed, 3 insertions, 5 deletions
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 { |
