about summary refs log tree commit diff
path: root/src/libcore/fmt/mod.rs
diff options
context:
space:
mode:
authorNick Cameron <ncameron@mozilla.com>2015-01-02 13:56:28 +1300
committerNick Cameron <ncameron@mozilla.com>2015-01-07 10:46:33 +1300
commitf7ff37e4c52a1d6562635fcd5bab6309cf75ea08 (patch)
tree9c69736bf3830f9048f61d45943bf0fa6326782d /src/libcore/fmt/mod.rs
parent918255ef8c3c21b2009204c3019239f8dc9f46bf (diff)
downloadrust-f7ff37e4c52a1d6562635fcd5bab6309cf75ea08.tar.gz
rust-f7ff37e4c52a1d6562635fcd5bab6309cf75ea08.zip
Replace full slice notation with index calls
Diffstat (limited to 'src/libcore/fmt/mod.rs')
-rw-r--r--src/libcore/fmt/mod.rs6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/libcore/fmt/mod.rs b/src/libcore/fmt/mod.rs
index 951f5c29f00..19c6b29417f 100644
--- a/src/libcore/fmt/mod.rs
+++ b/src/libcore/fmt/mod.rs
@@ -19,8 +19,8 @@ use kinds::{Copy, Sized};
 use mem;
 use option::Option;
 use option::Option::{Some, None};
-use ops::{Deref, FnOnce};
 use result::Result::Ok;
+use ops::{Deref, FnOnce, Index};
 use result;
 use slice::SliceExt;
 use slice;
@@ -413,7 +413,7 @@ impl<'a> Formatter<'a> {
             for c in sign.into_iter() {
                 let mut b = [0; 4];
                 let n = c.encode_utf8(&mut b).unwrap_or(0);
-                let b = unsafe { str::from_utf8_unchecked(b[0..n]) };
+                let b = unsafe { str::from_utf8_unchecked(b.index(&(0..n))) };
                 try!(f.buf.write_str(b));
             }
             if prefixed { f.buf.write_str(prefix) }
@@ -620,7 +620,7 @@ impl Show for char {
 
         let mut utf8 = [0u8; 4];
         let amt = self.encode_utf8(&mut utf8).unwrap_or(0);
-        let s: &str = unsafe { mem::transmute(utf8[..amt]) };
+        let s: &str = unsafe { mem::transmute(utf8.index(&(0..amt))) };
         Show::fmt(s, f)
     }
 }