about summary refs log tree commit diff
path: root/src/libsyntax/diagnostics/plugin.rs
diff options
context:
space:
mode:
authorJorge Aparicio <japaricious@gmail.com>2014-12-08 13:28:32 -0500
committerJorge Aparicio <japaricious@gmail.com>2014-12-13 17:03:47 -0500
commit0dac05dd627612232403c07ca8bd6d3376eec64a (patch)
tree656a23a7314866c8fa5cc6ca787111db41d90834 /src/libsyntax/diagnostics/plugin.rs
parent2160427900ea675e494274d42a8d8485724f440e (diff)
downloadrust-0dac05dd627612232403c07ca8bd6d3376eec64a.tar.gz
rust-0dac05dd627612232403c07ca8bd6d3376eec64a.zip
libsyntax: use unboxed closures
Diffstat (limited to 'src/libsyntax/diagnostics/plugin.rs')
-rw-r--r--src/libsyntax/diagnostics/plugin.rs12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/libsyntax/diagnostics/plugin.rs b/src/libsyntax/diagnostics/plugin.rs
index 2be11a236d3..cb2a1f8acd8 100644
--- a/src/libsyntax/diagnostics/plugin.rs
+++ b/src/libsyntax/diagnostics/plugin.rs
@@ -25,14 +25,18 @@ thread_local!(static USED_DIAGNOSTICS: RefCell<HashMap<Name, Span>> = {
     RefCell::new(HashMap::new())
 })
 
-fn with_registered_diagnostics<T>(f: |&mut HashMap<Name, Option<Name>>| -> T) -> T {
-    REGISTERED_DIAGNOSTICS.with(|slot| {
+fn with_registered_diagnostics<T, F>(f: F) -> T where
+    F: FnOnce(&mut HashMap<Name, Option<Name>>) -> T,
+{
+    REGISTERED_DIAGNOSTICS.with(move |slot| {
         f(&mut *slot.borrow_mut())
     })
 }
 
-fn with_used_diagnostics<T>(f: |&mut HashMap<Name, Span>| -> T) -> T {
-    USED_DIAGNOSTICS.with(|slot| {
+fn with_used_diagnostics<T, F>(f: F) -> T where
+    F: FnOnce(&mut HashMap<Name, Span>) -> T,
+{
+    USED_DIAGNOSTICS.with(move |slot| {
         f(&mut *slot.borrow_mut())
     })
 }