about summary refs log tree commit diff
path: root/src/libsyntax/parse/lexer
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/parse/lexer
parent2160427900ea675e494274d42a8d8485724f440e (diff)
downloadrust-0dac05dd627612232403c07ca8bd6d3376eec64a.tar.gz
rust-0dac05dd627612232403c07ca8bd6d3376eec64a.zip
libsyntax: use unboxed closures
Diffstat (limited to 'src/libsyntax/parse/lexer')
-rw-r--r--src/libsyntax/parse/lexer/mod.rs8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/libsyntax/parse/lexer/mod.rs b/src/libsyntax/parse/lexer/mod.rs
index 4c15fae9feb..50c7258fe1c 100644
--- a/src/libsyntax/parse/lexer/mod.rs
+++ b/src/libsyntax/parse/lexer/mod.rs
@@ -244,7 +244,9 @@ impl<'a> StringReader<'a> {
     /// Calls `f` with a string slice of the source text spanning from `start`
     /// up to but excluding `self.last_pos`, meaning the slice does not include
     /// the character `self.curr`.
-    pub fn with_str_from<T>(&self, start: BytePos, f: |s: &str| -> T) -> T {
+    pub fn with_str_from<T, F>(&self, start: BytePos, f: F) -> T where
+        F: FnOnce(&str) -> T,
+    {
         self.with_str_from_to(start, self.last_pos, f)
     }
 
@@ -264,7 +266,9 @@ impl<'a> StringReader<'a> {
 
     /// Calls `f` with a string slice of the source text spanning from `start`
     /// up to but excluding `end`.
-    fn with_str_from_to<T>(&self, start: BytePos, end: BytePos, f: |s: &str| -> T) -> T {
+    fn with_str_from_to<T, F>(&self, start: BytePos, end: BytePos, f: F) -> T where
+        F: FnOnce(&str) -> T,
+    {
         f(self.filemap.src.slice(
                 self.byte_offset(start).to_uint(),
                 self.byte_offset(end).to_uint()))