summaryrefslogtreecommitdiff
path: root/cli/lsp
diff options
context:
space:
mode:
Diffstat (limited to 'cli/lsp')
-rw-r--r--cli/lsp/language_server.rs13
-rw-r--r--cli/lsp/path_to_regex.rs17
2 files changed, 18 insertions, 12 deletions
diff --git a/cli/lsp/language_server.rs b/cli/lsp/language_server.rs
index 909d17bfe..1e9da54d6 100644
--- a/cli/lsp/language_server.rs
+++ b/cli/lsp/language_server.rs
@@ -13,6 +13,7 @@ use log::error;
use log::warn;
use serde_json::from_value;
use std::env;
+use std::fmt::Write as _;
use std::path::PathBuf;
use std::sync::Arc;
use tokio::fs;
@@ -2878,7 +2879,8 @@ impl Inner {
let measures = self.performance.to_vec();
let workspace_settings = self.config.get_workspace_settings();
- contents.push_str(&format!(
+ write!(
+ contents,
r#"# Deno Language Server Status
## Workspace Settings
@@ -2914,16 +2916,19 @@ impl Inner {
.map(|m| m.to_string())
.collect::<Vec<String>>()
.join("\n - ")
- ));
+ )
+ .unwrap();
contents
.push_str("\n## Performance\n\n|Name|Duration|Count|\n|---|---|---|\n");
let mut averages = self.performance.averages();
averages.sort();
for average in averages {
- contents.push_str(&format!(
+ writeln!(
+ contents,
"|{}|{}ms|{}|\n",
average.name, average.average_duration, average.count
- ));
+ )
+ .unwrap();
}
Some(contents)
} else {
diff --git a/cli/lsp/path_to_regex.rs b/cli/lsp/path_to_regex.rs
index b1929c9b9..937136ce3 100644
--- a/cli/lsp/path_to_regex.rs
+++ b/cli/lsp/path_to_regex.rs
@@ -33,6 +33,7 @@ use once_cell::sync::Lazy;
use regex::Regex;
use std::collections::HashMap;
use std::fmt;
+use std::fmt::Write as _;
use std::iter::Peekable;
static ESCAPE_STRING_RE: Lazy<Regex> =
@@ -268,9 +269,9 @@ impl StringOrVec {
let mut s = String::new();
for (i, segment) in v.iter().enumerate() {
if omit_initial_prefix && i == 0 {
- s.push_str(&format!("{}{}", segment, suffix));
+ write!(s, "{}{}", segment, suffix).unwrap();
} else {
- s.push_str(&format!("{}{}{}", prefix, segment, suffix));
+ write!(s, "{}{}{}", prefix, segment, suffix).unwrap();
}
}
s
@@ -618,10 +619,10 @@ pub fn tokens_to_regex(
if end {
if !strict {
- route.push_str(&format!(r"{}?", delimiter));
+ write!(route, r"{}?", delimiter).unwrap();
}
if has_ends_with {
- route.push_str(&format!(r"(?={})", ends_with));
+ write!(route, r"(?={})", ends_with).unwrap();
} else {
route.push('$');
}
@@ -639,11 +640,11 @@ pub fn tokens_to_regex(
};
if !strict {
- route.push_str(&format!(r"(?:{}(?={}))?", delimiter, ends_with));
+ write!(route, r"(?:{}(?={}))?", delimiter, ends_with).unwrap();
}
if !is_end_deliminated {
- route.push_str(&format!(r"(?={}|{})", delimiter, ends_with));
+ write!(route, r"(?={}|{})", delimiter, ends_with).unwrap();
}
}
@@ -753,7 +754,7 @@ impl Compiler {
}
}
}
- path.push_str(&format!("{}{}{}", prefix, segment, suffix));
+ write!(path, "{}{}{}", prefix, segment, suffix).unwrap();
}
}
}
@@ -772,7 +773,7 @@ impl Compiler {
}
let prefix = k.prefix.clone().unwrap_or_default();
let suffix = k.suffix.clone().unwrap_or_default();
- path.push_str(&format!("{}{}{}", prefix, s, suffix));
+ write!(path, "{}{}{}", prefix, s, suffix).unwrap();
}
None => {
if !optional {