summaryrefslogtreecommitdiffstats
path: root/vendor/regex-syntax/src/hir/literal
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:06:37 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:06:37 +0000
commit246f239d9f40f633160f0c18f87a20922d4e77bb (patch)
tree5a88572663584b3d4d28e5a20e10abab1be40884 /vendor/regex-syntax/src/hir/literal
parentReleasing progress-linux version 1.64.0+dfsg1-1~progress7.99u1. (diff)
downloadrustc-246f239d9f40f633160f0c18f87a20922d4e77bb.tar.xz
rustc-246f239d9f40f633160f0c18f87a20922d4e77bb.zip
Merging debian version 1.65.0+dfsg1-2.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'vendor/regex-syntax/src/hir/literal')
-rw-r--r--vendor/regex-syntax/src/hir/literal/mod.rs28
1 files changed, 12 insertions, 16 deletions
diff --git a/vendor/regex-syntax/src/hir/literal/mod.rs b/vendor/regex-syntax/src/hir/literal/mod.rs
index 1e66d2cc3..fbc5d3c97 100644
--- a/vendor/regex-syntax/src/hir/literal/mod.rs
+++ b/vendor/regex-syntax/src/hir/literal/mod.rs
@@ -225,7 +225,7 @@ impl Literals {
if self.lits.is_empty() {
return self.to_empty();
}
- let mut old: Vec<Literal> = self.lits.iter().cloned().collect();
+ let mut old = self.lits.to_vec();
let mut new = self.to_empty();
'OUTER: while let Some(mut candidate) = old.pop() {
if candidate.is_empty() {
@@ -256,15 +256,13 @@ impl Literals {
old.push(lit3);
lit2.clear();
}
- } else {
- if let Some(i) = position(&lit2, &candidate) {
- lit2.cut();
- let mut new_candidate = candidate.clone();
- new_candidate.truncate(i);
- new_candidate.cut();
- old.push(new_candidate);
- candidate.clear();
- }
+ } else if let Some(i) = position(&lit2, &candidate) {
+ lit2.cut();
+ let mut new_candidate = candidate.clone();
+ new_candidate.truncate(i);
+ new_candidate.cut();
+ old.push(new_candidate);
+ candidate.clear();
}
// Oops, the candidate is already represented in the set.
if candidate.is_empty() {
@@ -793,7 +791,7 @@ fn repeat_range_literals<F: FnMut(&Hir, &mut Literals)>(
f(
&Hir::repetition(hir::Repetition {
kind: hir::RepetitionKind::ZeroOrMore,
- greedy: greedy,
+ greedy,
hir: Box::new(e.clone()),
}),
lits,
@@ -932,12 +930,10 @@ fn escape_unicode(bytes: &[u8]) -> String {
if c.is_whitespace() {
let escaped = if c as u32 <= 0x7F {
escape_byte(c as u8)
+ } else if c as u32 <= 0xFFFF {
+ format!(r"\u{{{:04x}}}", c as u32)
} else {
- if c as u32 <= 0xFFFF {
- format!(r"\u{{{:04x}}}", c as u32)
- } else {
- format!(r"\U{{{:08x}}}", c as u32)
- }
+ format!(r"\U{{{:08x}}}", c as u32)
};
space_escaped.push_str(&escaped);
} else {