From 11613fc1c048f5bec4cf792397a15bdd17dfd797 Mon Sep 17 00:00:00 2001 From: Kevin Ballard Date: Sat, 3 May 2014 22:02:59 -0700 Subject: Handle fallout in std::ascii and std::strconv API changes: - OwnedAsciiCast returns Vec instead of ~[Ascii] - OwnedAsciiCast is implemented on Vec - AsciiStr.to_lower/upper() returns Vec - IntoBytes::into_bytes() returns Vec - float_to_str_bytes_common() returns (Vec, bool) --- src/libstd/num/strconv.rs | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'src/libstd/num') diff --git a/src/libstd/num/strconv.rs b/src/libstd/num/strconv.rs index 8861597bb4c..618449939ce 100644 --- a/src/libstd/num/strconv.rs +++ b/src/libstd/num/strconv.rs @@ -22,8 +22,8 @@ use option::{None, Option, Some}; use slice::OwnedVector; use slice::{CloneableVector, ImmutableVector, MutableVector}; use std::cmp::{Ord, Eq}; -use str::{StrSlice}; -use str; +use str::{Str, StrSlice}; +use strbuf::StrBuf; use vec::Vec; /// A flag that specifies whether to use exponential (scientific) notation. @@ -262,7 +262,7 @@ pub fn float_to_str_bytes_common+Neg+Rem+Mul>( num: T, radix: uint, negative_zero: bool, sign: SignFormat, digits: SignificantDigits, exp_format: ExponentFormat, exp_upper: bool - ) -> (~[u8], bool) { + ) -> (Vec, bool) { assert!(2 <= radix && radix <= 36); match exp_format { ExpDec if radix >= DIGIT_E_RADIX // decimal exponent 'e' @@ -278,17 +278,17 @@ pub fn float_to_str_bytes_common { return ("NaN".as_bytes().to_owned(), true); } + FPNaN => { return (Vec::from_slice("NaN".as_bytes()), true); } FPInfinite if num > _0 => { return match sign { - SignAll => ("+inf".as_bytes().to_owned(), true), - _ => ("inf".as_bytes().to_owned(), true) + SignAll => (Vec::from_slice("+inf".as_bytes()), true), + _ => (Vec::from_slice("inf".as_bytes()), true) }; } FPInfinite if num < _0 => { return match sign { - SignNone => ("inf".as_bytes().to_owned(), true), - _ => ("-inf".as_bytes().to_owned(), true), + SignNone => (Vec::from_slice("inf".as_bytes()), true), + _ => (Vec::from_slice("-inf".as_bytes()), true), }; } _ => {} @@ -483,7 +483,7 @@ pub fn float_to_str_bytes_common (~str, bool) { let (bytes, special) = float_to_str_bytes_common(num, radix, negative_zero, sign, digits, exp_format, exp_capital); - (str::from_utf8_owned(bytes).unwrap(), special) + (StrBuf::from_utf8(bytes).unwrap().into_owned(), special) } // Some constants for from_str_bytes_common's input validation, -- cgit 1.4.1-3-g733a5