Skip to content

Commit 38fdf98

Browse files
committed
Revert incompatible changes
1 parent ad76f3c commit 38fdf98

File tree

1 file changed

+18
-18
lines changed

1 file changed

+18
-18
lines changed

src/re.rs

+18-18
Original file line numberDiff line numberDiff line change
@@ -821,12 +821,14 @@ impl NamedGroups {
821821
match *regex {
822822
Regex::Native(ExNative { ref groups, .. }) =>
823823
NamedGroups::Native(groups),
824-
Regex::Dynamic(ref exec) =>
825-
if exec.named_groups().is_empty() {
824+
Regex::Dynamic(ref exec) => {
825+
let groups = exec.named_groups();
826+
if groups.is_empty() {
826827
NamedGroups::Empty
827828
} else {
828-
NamedGroups::Dynamic(exec.named_groups().clone())
829+
NamedGroups::Dynamic(groups.clone())
829830
}
831+
}
830832
}
831833
}
832834

@@ -924,21 +926,21 @@ impl<'t> Captures<'t> {
924926

925927
/// Creates an iterator of all the capture groups in order of appearance
926928
/// in the regular expression.
927-
pub fn iter<'c>(&'c self) -> SubCaptures<'c, 't> {
929+
pub fn iter(&'t self) -> SubCaptures<'t> {
928930
SubCaptures { idx: 0, caps: self, }
929931
}
930932

931933
/// Creates an iterator of all the capture group positions in order of
932934
/// appearance in the regular expression. Positions are byte indices
933935
/// in terms of the original string matched.
934-
pub fn iter_pos<'c>(&'c self) -> SubCapturesPos<'c> {
936+
pub fn iter_pos(&'t self) -> SubCapturesPos<'t> {
935937
SubCapturesPos { idx: 0, locs: &self.locs }
936938
}
937939

938940
/// Creates an iterator of all named groups as an tuple with the group
939941
/// name and the value. The iterator returns these values in arbitrary
940942
/// order.
941-
pub fn iter_named<'c: 't>(&'c self) -> SubCapturesNamed<'c, 't> {
943+
pub fn iter_named(&'t self) -> SubCapturesNamed<'t> {
942944
SubCapturesNamed {
943945
caps: self,
944946
names: self.named_groups.iter()
@@ -1015,17 +1017,16 @@ impl<'t> Index<&'t str> for Captures<'t> {
10151017
/// An iterator over capture groups for a particular match of a regular
10161018
/// expression.
10171019
///
1018-
/// `'t` is the lifetime of the matched text.
10191020
/// `'c` is the lifetime of the captures.
1020-
pub struct SubCaptures<'c, 't: 'c> {
1021+
pub struct SubCaptures<'c> {
10211022
idx: usize,
1022-
caps: &'c Captures<'t>,
1023+
caps: &'c Captures<'c>,
10231024
}
10241025

1025-
impl<'c, 't> Iterator for SubCaptures<'c, 't> {
1026-
type Item = Option<&'t str>;
1026+
impl<'c> Iterator for SubCaptures<'c> {
1027+
type Item = Option<&'c str>;
10271028

1028-
fn next(&mut self) -> Option<Option<&'t str>> {
1029+
fn next(&mut self) -> Option<Option<&'c str>> {
10291030
if self.idx < self.caps.len() {
10301031
self.idx += 1;
10311032
Some(self.caps.at(self.idx - 1))
@@ -1066,17 +1067,16 @@ impl<'c> Iterator for SubCapturesPos<'c> {
10661067
/// An Iterator over named capture groups as a tuple with the group
10671068
/// name and the value.
10681069
///
1069-
/// `'t` is the lifetime of the matched text.
10701070
/// `'c` is the lifetime of the captures.
1071-
pub struct SubCapturesNamed<'c, 't: 'c> {
1072-
caps: &'c Captures<'t>,
1071+
pub struct SubCapturesNamed<'c> {
1072+
caps: &'c Captures<'c>,
10731073
names: NamedGroupsIter<'c>,
10741074
}
10751075

1076-
impl<'c, 't: 'c> Iterator for SubCapturesNamed<'c, 't> {
1077-
type Item = (&'c str, Option<&'t str>);
1076+
impl<'c> Iterator for SubCapturesNamed<'c> {
1077+
type Item = (&'c str, Option<&'c str>);
10781078

1079-
fn next(&mut self) -> Option<(&'c str, Option<&'t str>)> {
1079+
fn next(&mut self) -> Option<(&'c str, Option<&'c str>)> {
10801080
self.names.next().map(|(name, pos)| (name, self.caps.at(pos)))
10811081
}
10821082
}

0 commit comments

Comments
 (0)