Skip to content

Commit

Permalink
tests: fix lifetime warning
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
BurntSushi committed Jun 9, 2019
1 parent 62f9669 commit 3f7a603
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions tests/replace.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,11 @@ replace!(no_expand2, replace,
r"(\S+)\s+(\S+)", "w1 w2", no_expand!("$$1"), "$$1");
use_!(Captures);
replace!(closure_returning_reference, replace, r"(\d+)", "age: 26",
| captures: &Captures | &match_text!(captures.get(1).unwrap())[0..1], "age: 2");
|captures: &Captures| {
match_text!(captures.get(1).unwrap())[0..1].to_owned()
}, "age: 2");
replace!(closure_returning_value, replace, r"\d+", "age: 26",
| _captures: &Captures | t!("Z").to_owned(), "age: Z");
|_captures: &Captures| t!("Z").to_owned(), "age: Z");


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

0 comments on commit 3f7a603

Please sign in to comment.