Skip to content

Commit 3f7a603

Browse files
committed
tests: fix lifetime warning
Apparently we were hitting a bug in borrowck that was fixed, but now emits a warning. It doesn't appear necessary for us to return a borrow, so we just copy.
1 parent 62f9669 commit 3f7a603

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

tests/replace.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,11 @@ replace!(no_expand2, replace,
3535
r"(\S+)\s+(\S+)", "w1 w2", no_expand!("$$1"), "$$1");
3636
use_!(Captures);
3737
replace!(closure_returning_reference, replace, r"(\d+)", "age: 26",
38-
| captures: &Captures | &match_text!(captures.get(1).unwrap())[0..1], "age: 2");
38+
|captures: &Captures| {
39+
match_text!(captures.get(1).unwrap())[0..1].to_owned()
40+
}, "age: 2");
3941
replace!(closure_returning_value, replace, r"\d+", "age: 26",
40-
| _captures: &Captures | t!("Z").to_owned(), "age: Z");
42+
|_captures: &Captures| t!("Z").to_owned(), "age: Z");
4143

4244

4345
// See https://github.com/rust-lang/regex/issues/314

0 commit comments

Comments
 (0)