about summary refs log tree commit diff
path: root/src/libcore/fmt/float.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/libcore/fmt/float.rs')
-rw-r--r--src/libcore/fmt/float.rs9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/libcore/fmt/float.rs b/src/libcore/fmt/float.rs
index 400ce76baa0..fb4d91e912a 100644
--- a/src/libcore/fmt/float.rs
+++ b/src/libcore/fmt/float.rs
@@ -20,6 +20,7 @@ use fmt;
 use iter::{range, DoubleEndedIteratorExt};
 use num::{Float, FPNaN, FPInfinite, ToPrimitive};
 use num::cast;
+use ops::FnOnce;
 use result::Result::Ok;
 use slice::{mod, SlicePrelude};
 use str::StrPrelude;
@@ -84,7 +85,7 @@ static DIGIT_E_RADIX: uint = ('e' as uint) - ('a' as uint) + 11u;
 ///   between digit and exponent sign `'e'`.
 /// - Panics if `radix` > 25 and `exp_format` is `ExpBin` due to conflict
 ///   between digit and exponent sign `'p'`.
-pub fn float_to_str_bytes_common<T: Float, U>(
+pub fn float_to_str_bytes_common<T: Float, U, F>(
     num: T,
     radix: uint,
     negative_zero: bool,
@@ -92,8 +93,10 @@ pub fn float_to_str_bytes_common<T: Float, U>(
     digits: SignificantDigits,
     exp_format: ExponentFormat,
     exp_upper: bool,
-    f: |&[u8]| -> U
-) -> U {
+    f: F
+) -> U where
+    F: FnOnce(&[u8]) -> U,
+{
     assert!(2 <= radix && radix <= 36);
     match exp_format {
         ExpDec if radix >= DIGIT_E_RADIX       // decimal exponent 'e'