summaryrefslogtreecommitdiff
path: root/cli/lsp/path_to_regex.rs
diff options
context:
space:
mode:
authorBartek IwaƄczuk <biwanczuk@gmail.com>2022-07-01 15:28:06 +0200
committerGitHub <noreply@github.com>2022-07-01 15:28:06 +0200
commitb8b82c3ea4ec154581f57b0d00f08f2fd1d871ce (patch)
treed94e3230479fe44dfe347d452423f98a5a1d8a47 /cli/lsp/path_to_regex.rs
parent77c25beaa59d64035c20ef59d93ed5a99677bc93 (diff)
chore: use Rust 1.62.0 (#15028)
Diffstat (limited to 'cli/lsp/path_to_regex.rs')
-rw-r--r--cli/lsp/path_to_regex.rs17
1 files changed, 9 insertions, 8 deletions
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 {