Fallout of std::str stabilization
This commit is contained in:
parent
4908017d59
commit
082bfde412
193 changed files with 2143 additions and 2230 deletions
|
|
@ -242,10 +242,11 @@ use result::Result;
|
|||
use result::Result::{Ok, Err};
|
||||
use sys;
|
||||
use slice::SliceExt;
|
||||
use str::StrPrelude;
|
||||
use str::StrExt;
|
||||
use str;
|
||||
use string::String;
|
||||
use uint;
|
||||
use unicode;
|
||||
use unicode::char::UnicodeChar;
|
||||
use vec::Vec;
|
||||
|
||||
|
|
@ -1505,7 +1506,7 @@ pub trait Buffer: Reader {
|
|||
/// valid utf-8 encoded codepoint as the next few bytes in the stream.
|
||||
fn read_char(&mut self) -> IoResult<char> {
|
||||
let first_byte = try!(self.read_byte());
|
||||
let width = str::utf8_char_width(first_byte);
|
||||
let width = unicode::str::utf8_char_width(first_byte);
|
||||
if width == 1 { return Ok(first_byte as char) }
|
||||
if width == 0 { return Err(standard_error(InvalidInput)) } // not utf8
|
||||
let mut buf = [first_byte, 0, 0, 0];
|
||||
|
|
@ -1519,7 +1520,7 @@ pub trait Buffer: Reader {
|
|||
}
|
||||
}
|
||||
}
|
||||
match str::from_utf8(buf[..width]) {
|
||||
match str::from_utf8(buf[..width]).ok() {
|
||||
Some(s) => Ok(s.char_at(0)),
|
||||
None => Err(standard_error(InvalidInput))
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,8 +25,8 @@ use ops::FnOnce;
|
|||
use option::Option;
|
||||
use option::Option::{None, Some};
|
||||
use result::Result::{Ok, Err};
|
||||
use str::{FromStr, StrPrelude};
|
||||
use slice::{CloneSliceExt, SliceExt};
|
||||
use str::{FromStr, StrExt};
|
||||
use vec::Vec;
|
||||
|
||||
pub type Port = u16;
|
||||
|
|
|
|||
|
|
@ -1082,7 +1082,7 @@ mod tests {
|
|||
|
||||
let prog = env_cmd().env_set_all(new_env.as_slice()).spawn().unwrap();
|
||||
let result = prog.wait_with_output().unwrap();
|
||||
let output = String::from_utf8_lossy(result.output.as_slice()).into_string();
|
||||
let output = String::from_utf8_lossy(result.output.as_slice()).to_string();
|
||||
|
||||
assert!(output.contains("RUN_TEST_NEW_ENV=123"),
|
||||
"didn't find RUN_TEST_NEW_ENV inside of:\n\n{}", output);
|
||||
|
|
@ -1092,7 +1092,7 @@ mod tests {
|
|||
fn test_add_to_env() {
|
||||
let prog = env_cmd().env("RUN_TEST_NEW_ENV", "123").spawn().unwrap();
|
||||
let result = prog.wait_with_output().unwrap();
|
||||
let output = String::from_utf8_lossy(result.output.as_slice()).into_string();
|
||||
let output = String::from_utf8_lossy(result.output.as_slice()).to_string();
|
||||
|
||||
assert!(output.contains("RUN_TEST_NEW_ENV=123"),
|
||||
"didn't find RUN_TEST_NEW_ENV inside of:\n\n{}", output);
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ use ops::{Deref, DerefMut, FnOnce};
|
|||
use result::Result::{Ok, Err};
|
||||
use rt;
|
||||
use slice::SliceExt;
|
||||
use str::StrPrelude;
|
||||
use str::StrExt;
|
||||
use string::String;
|
||||
use sys::{fs, tty};
|
||||
use sync::{Arc, Mutex, MutexGuard, Once, ONCE_INIT};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue