summaryrefslogtreecommitdiff
path: root/cli/lsp/code_lens.rs
diff options
context:
space:
mode:
authorYiyu Lin <linyiyu1992@gmail.com>2023-04-13 09:08:01 +0800
committerGitHub <noreply@github.com>2023-04-13 03:08:01 +0200
commitd790ea7d533c3c48b09a2f16f3fef549aa96be78 (patch)
treeb31fc35baf1f634054f52e94626f0399d187b99b /cli/lsp/code_lens.rs
parent19c3e4f6dc31fd78e2793d0596d6a9cc3a30580a (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 'cli/lsp/code_lens.rs')
-rw-r--r--cli/lsp/code_lens.rs7
1 files changed, 3 insertions, 4 deletions
diff --git a/cli/lsp/code_lens.rs b/cli/lsp/code_lens.rs
index 650e5e241..6327b7a9c 100644
--- a/cli/lsp/code_lens.rs
+++ b/cli/lsp/code_lens.rs
@@ -21,6 +21,7 @@ use deno_core::serde::Serialize;
use deno_core::serde_json;
use deno_core::serde_json::json;
use deno_core::ModuleSpecifier;
+use lazy_regex::lazy_regex;
use once_cell::sync::Lazy;
use regex::Regex;
use std::cell::RefCell;
@@ -29,11 +30,9 @@ use std::rc::Rc;
use std::sync::Arc;
use tower_lsp::lsp_types as lsp;
-static ABSTRACT_MODIFIER: Lazy<Regex> =
- Lazy::new(|| Regex::new(r"\babstract\b").unwrap());
+static ABSTRACT_MODIFIER: Lazy<Regex> = lazy_regex!(r"\babstract\b");
-static EXPORT_MODIFIER: Lazy<Regex> =
- Lazy::new(|| Regex::new(r"\bexport\b").unwrap());
+static EXPORT_MODIFIER: Lazy<Regex> = lazy_regex!(r"\bexport\b");
#[derive(Debug, Deserialize, Serialize)]
pub enum CodeLensSource {