From 61ba334452102e7c7bf227927d56c28ec4f025f3 Mon Sep 17 00:00:00 2001 From: Jorge Aparicio Date: Sat, 6 Dec 2014 19:35:02 -0500 Subject: [PATCH] libregex: impl Replacer for FnMut(&Captures) -> String implementors --- src/libregex/re.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/libregex/re.rs b/src/libregex/re.rs index 2a1fda06431..ec93a2b5a59 100644 --- a/src/libregex/re.rs +++ b/src/libregex/re.rs @@ -585,7 +585,7 @@ impl<'t> Replacer for &'t str { } } -impl<'t> Replacer for |&Captures|: 't -> String { +impl Replacer for F where F: FnMut(&Captures) -> String { fn reg_replace<'a>(&'a mut self, caps: &Captures) -> CowString<'a> { (*self)(caps).into_cow() } @@ -767,7 +767,7 @@ impl<'t> Captures<'t> { // How evil can you get? // FIXME: Don't use regexes for this. It's completely unnecessary. let re = Regex::new(r"(^|[^$]|\b)\$(\w+)").unwrap(); - let text = re.replace_all(text, |refs: &Captures| -> String { + let text = re.replace_all(text, |&mut: refs: &Captures| -> String { let (pre, name) = (refs.at(1), refs.at(2)); format!("{}{}", pre, match from_str::(name.as_slice()) {