diff options
| author | Jorge Aparicio <japaricious@gmail.com> | 2014-12-06 19:35:02 -0500 |
|---|---|---|
| committer | Jorge Aparicio <japaricious@gmail.com> | 2014-12-13 17:03:46 -0500 |
| commit | 61ba334452102e7c7bf227927d56c28ec4f025f3 (patch) | |
| tree | 51cbaf5a1368b26888f714331f16c7b2aee4e25a /src | |
| parent | 01d2e46a2d952c65071b363701faa6eea952d55f (diff) | |
| download | rust-61ba334452102e7c7bf227927d56c28ec4f025f3.tar.gz rust-61ba334452102e7c7bf227927d56c28ec4f025f3.zip | |
libregex: impl Replacer for FnMut(&Captures) -> String implementors
Diffstat (limited to 'src')
| -rw-r--r-- | src/libregex/re.rs | 4 |
1 files 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<F> 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::<uint>(name.as_slice()) { |
