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()) {