diff options
Diffstat (limited to 'src/libcore/fmt')
| -rw-r--r-- | src/libcore/fmt/float.rs | 8 | ||||
| -rw-r--r-- | src/libcore/fmt/mod.rs | 8 | ||||
| -rw-r--r-- | src/libcore/fmt/num.rs | 4 |
3 files changed, 10 insertions, 10 deletions
diff --git a/src/libcore/fmt/float.rs b/src/libcore/fmt/float.rs index 343ab7cfd28..92ef0c281f2 100644 --- a/src/libcore/fmt/float.rs +++ b/src/libcore/fmt/float.rs @@ -17,7 +17,7 @@ use iter::{range, DoubleEndedIterator}; use num::{Float, FPNaN, FPInfinite, ToPrimitive, Primitive}; use num::{Zero, One, cast}; use result::Ok; -use slice::MutableSlice; +use slice::{ImmutableSlice, MutableSlice}; use slice; use str::StrSlice; @@ -173,7 +173,7 @@ pub fn float_to_str_bytes_common<T: Primitive + Float, U>( _ => () } - buf[mut ..end].reverse(); + buf.slice_to_mut(end).reverse(); // Remember start of the fractional digits. // Points one beyond end of buf if none get generated, @@ -310,7 +310,7 @@ pub fn float_to_str_bytes_common<T: Primitive + Float, U>( impl<'a> fmt::FormatWriter for Filler<'a> { fn write(&mut self, bytes: &[u8]) -> fmt::Result { - slice::bytes::copy_memory(self.buf[mut *self.end..], + slice::bytes::copy_memory(self.buf.slice_from_mut(*self.end), bytes); *self.end += bytes.len(); Ok(()) @@ -328,5 +328,5 @@ pub fn float_to_str_bytes_common<T: Primitive + Float, U>( } } - f(buf[..end]) + f(buf.slice_to(end)) } diff --git a/src/libcore/fmt/mod.rs b/src/libcore/fmt/mod.rs index 28ee522346f..7bab59960b0 100644 --- a/src/libcore/fmt/mod.rs +++ b/src/libcore/fmt/mod.rs @@ -423,7 +423,7 @@ impl<'a> Formatter<'a> { for c in sign.into_iter() { let mut b = [0, ..4]; let n = c.encode_utf8(b).unwrap_or(0); - try!(f.buf.write(b[..n])); + try!(f.buf.write(b.slice_to(n))); } if prefixed { f.buf.write(prefix.as_bytes()) } else { Ok(()) } @@ -530,13 +530,13 @@ impl<'a> Formatter<'a> { let len = self.fill.encode_utf8(fill).unwrap_or(0); for _ in range(0, pre_pad) { - try!(self.buf.write(fill[..len])); + try!(self.buf.write(fill.slice_to(len))); } try!(f(self)); for _ in range(0, post_pad) { - try!(self.buf.write(fill[..len])); + try!(self.buf.write(fill.slice_to(len))); } Ok(()) @@ -611,7 +611,7 @@ impl Char for char { let mut utf8 = [0u8, ..4]; let amt = self.encode_utf8(utf8).unwrap_or(0); - let s: &str = unsafe { mem::transmute(utf8[..amt]) }; + let s: &str = unsafe { mem::transmute(utf8.slice_to(amt)) }; secret_string(&s, f) } } diff --git a/src/libcore/fmt/num.rs b/src/libcore/fmt/num.rs index e57c4999483..afcd0d1d645 100644 --- a/src/libcore/fmt/num.rs +++ b/src/libcore/fmt/num.rs @@ -18,7 +18,7 @@ use collections::Collection; use fmt; use iter::DoubleEndedIterator; use num::{Int, cast, zero}; -use slice::{MutableSlice}; +use slice::{ImmutableSlice, MutableSlice}; /// A type that represents a specific radix #[doc(hidden)] @@ -60,7 +60,7 @@ trait GenericRadix { if x == zero() { break; } // No more digits left to accumulate. } } - f.pad_integral(is_positive, self.prefix(), buf[curr..]) + f.pad_integral(is_positive, self.prefix(), buf.slice_from(curr)) } } |
