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( +pub fn float_to_str_bytes_common( num: T, radix: uint, negative_zero: bool, @@ -92,8 +93,10 @@ pub fn float_to_str_bytes_common( 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'