From cdbb3ca9b776b066e2c93acfb60da8537d2b1c9b Mon Sep 17 00:00:00 2001 From: Jorge Aparicio Date: Sun, 7 Dec 2014 14:15:25 -0500 Subject: libstd: use unboxed closures --- src/libstd/time/duration.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/libstd/time') diff --git a/src/libstd/time/duration.rs b/src/libstd/time/duration.rs index 7e6065129a3..34a3d6aa275 100644 --- a/src/libstd/time/duration.rs +++ b/src/libstd/time/duration.rs @@ -14,7 +14,7 @@ use {fmt, i64}; use kinds::Copy; -use ops::{Add, Sub, Mul, Div, Neg}; +use ops::{Add, Sub, Mul, Div, Neg, FnOnce}; use option::Option; use option::Option::{Some, None}; use num::Int; @@ -141,7 +141,7 @@ impl Duration { /// Runs a closure, returning the duration of time it took to run the /// closure. - pub fn span(f: ||) -> Duration { + pub fn span(f: F) -> Duration where F: FnOnce() { let before = super::precise_time_ns(); f(); Duration::nanoseconds((super::precise_time_ns() - before) as i64) -- cgit 1.4.1-3-g733a5