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.rs4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/libcore/fmt/float.rs b/src/libcore/fmt/float.rs
index f63242b4f85..d833b8fed77 100644
--- a/src/libcore/fmt/float.rs
+++ b/src/libcore/fmt/float.rs
@@ -20,7 +20,7 @@ use fmt;
 use iter::{IteratorExt, range};
 use num::{cast, Float, ToPrimitive};
 use num::FpCategory as Fp;
-use ops::FnOnce;
+use ops::{FnOnce, Index};
 use result::Result::Ok;
 use slice::{self, SliceExt};
 use str::{self, StrExt};
@@ -332,5 +332,5 @@ pub fn float_to_str_bytes_common<T: Float, U, F>(
         }
     }
 
-    f(unsafe { str::from_utf8_unchecked(buf[..end]) })
+    f(unsafe { str::from_utf8_unchecked(buf.index(&(0..end))) })
 }