diff options
| author | Richo Healey <richo@psych0tik.net> | 2014-05-25 03:17:19 -0700 |
|---|---|---|
| committer | Richo Healey <richo@psych0tik.net> | 2014-05-27 12:59:31 -0700 |
| commit | 1f1b2e42d76ba1cd884adc49922636a6c2ac1b2f (patch) | |
| tree | 2a56d5ceda84c1a58796fe0fc4e7cea38a9336f6 /src/libstd | |
| parent | 4348e23b269739657d934b532ad061bfd6d92309 (diff) | |
| download | rust-1f1b2e42d76ba1cd884adc49922636a6c2ac1b2f.tar.gz rust-1f1b2e42d76ba1cd884adc49922636a6c2ac1b2f.zip | |
std: Rename strbuf operations to string
[breaking-change]
Diffstat (limited to 'src/libstd')
| -rw-r--r-- | src/libstd/ascii.rs | 76 | ||||
| -rw-r--r-- | src/libstd/fmt.rs | 4 | ||||
| -rw-r--r-- | src/libstd/io/buffered.rs | 12 | ||||
| -rw-r--r-- | src/libstd/io/mem.rs | 4 | ||||
| -rw-r--r-- | src/libstd/io/mod.rs | 8 | ||||
| -rw-r--r-- | src/libstd/io/net/ip.rs | 6 | ||||
| -rw-r--r-- | src/libstd/io/process.rs | 24 | ||||
| -rw-r--r-- | src/libstd/io/stdio.rs | 2 | ||||
| -rw-r--r-- | src/libstd/local_data.rs | 24 | ||||
| -rw-r--r-- | src/libstd/num/int_macros.rs | 26 | ||||
| -rw-r--r-- | src/libstd/num/uint_macros.rs | 30 | ||||
| -rw-r--r-- | src/libstd/os.rs | 26 | ||||
| -rw-r--r-- | src/libstd/path/posix.rs | 4 | ||||
| -rw-r--r-- | src/libstd/path/windows.rs | 12 | ||||
| -rw-r--r-- | src/libstd/repr.rs | 2 | ||||
| -rw-r--r-- | src/libstd/rt/task.rs | 4 | ||||
| -rw-r--r-- | src/libstd/slice.rs | 16 | ||||
| -rw-r--r-- | src/libstd/str.rs | 56 | ||||
| -rw-r--r-- | src/libstd/string.rs | 4 | ||||
| -rw-r--r-- | src/libstd/task.rs | 4 | ||||
| -rw-r--r-- | src/libstd/to_str.rs | 24 | ||||
| -rw-r--r-- | src/libstd/unstable/dynamic_lib.rs | 2 | ||||
| -rw-r--r-- | src/libstd/vec.rs | 4 |
23 files changed, 187 insertions, 187 deletions
diff --git a/src/libstd/ascii.rs b/src/libstd/ascii.rs index d3b98b02bd0..55bbf4ddf75 100644 --- a/src/libstd/ascii.rs +++ b/src/libstd/ascii.rs @@ -366,7 +366,7 @@ impl IntoStr for Vec<Ascii> { fn into_str(self) -> String { unsafe { let s: &str = mem::transmute(self.as_slice()); - s.to_strbuf() + s.to_string() } } } @@ -456,16 +456,16 @@ unsafe fn str_map_bytes(string: String, map: &'static [u8]) -> String { *b = map[*b as uint]; } - str::from_utf8(bytes.as_slice()).unwrap().to_strbuf() + str::from_utf8(bytes.as_slice()).unwrap().to_string() } #[inline] unsafe fn str_copy_map_bytes(string: &str, map: &'static [u8]) -> String { - let mut s = string.to_strbuf(); + let mut s = string.to_string(); for b in s.as_mut_bytes().mut_iter() { *b = map[*b as uint]; } - s.into_strbuf() + s.into_string() } static ASCII_LOWER_MAP: &'static [u8] = &[ @@ -594,14 +594,14 @@ mod tests { assert_eq!("( ;".to_ascii(), v2ascii!([40, 32, 59])); let v = box [40u8, 32u8, 59u8]; assert_eq!(v.to_ascii(), v2ascii!([40, 32, 59])); - assert_eq!("( ;".to_strbuf().as_slice().to_ascii(), v2ascii!([40, 32, 59])); + assert_eq!("( ;".to_string().as_slice().to_ascii(), v2ascii!([40, 32, 59])); - assert_eq!("abCDef&?#".to_ascii().to_lower().into_str(), "abcdef&?#".to_strbuf()); - assert_eq!("abCDef&?#".to_ascii().to_upper().into_str(), "ABCDEF&?#".to_strbuf()); + assert_eq!("abCDef&?#".to_ascii().to_lower().into_str(), "abcdef&?#".to_string()); + assert_eq!("abCDef&?#".to_ascii().to_upper().into_str(), "ABCDEF&?#".to_string()); - assert_eq!("".to_ascii().to_lower().into_str(), "".to_strbuf()); - assert_eq!("YMCA".to_ascii().to_lower().into_str(), "ymca".to_strbuf()); - assert_eq!("abcDEFxyz:.;".to_ascii().to_upper().into_str(), "ABCDEFXYZ:.;".to_strbuf()); + assert_eq!("".to_ascii().to_lower().into_str(), "".to_string()); + assert_eq!("YMCA".to_ascii().to_lower().into_str(), "ymca".to_string()); + assert_eq!("abcDEFxyz:.;".to_ascii().to_upper().into_str(), "ABCDEFXYZ:.;".to_string()); assert!("aBcDeF&?#".to_ascii().eq_ignore_case("AbCdEf&?#".to_ascii())); @@ -613,16 +613,16 @@ mod tests { #[test] fn test_ascii_vec_ng() { - assert_eq!("abCDef&?#".to_ascii().to_lower().into_str(), "abcdef&?#".to_strbuf()); - assert_eq!("abCDef&?#".to_ascii().to_upper().into_str(), "ABCDEF&?#".to_strbuf()); - assert_eq!("".to_ascii().to_lower().into_str(), "".to_strbuf()); - assert_eq!("YMCA".to_ascii().to_lower().into_str(), "ymca".to_strbuf()); - assert_eq!("abcDEFxyz:.;".to_ascii().to_upper().into_str(), "ABCDEFXYZ:.;".to_strbuf()); + assert_eq!("abCDef&?#".to_ascii().to_lower().into_str(), "abcdef&?#".to_string()); + assert_eq!("abCDef&?#".to_ascii().to_upper().into_str(), "ABCDEF&?#".to_string()); + assert_eq!("".to_ascii().to_lower().into_str(), "".to_string()); + assert_eq!("YMCA".to_ascii().to_lower().into_str(), "ymca".to_string()); + assert_eq!("abcDEFxyz:.;".to_ascii().to_upper().into_str(), "ABCDEFXYZ:.;".to_string()); } #[test] fn test_owned_ascii_vec() { - assert_eq!(("( ;".to_strbuf()).into_ascii(), vec2ascii![40, 32, 59]); + assert_eq!(("( ;".to_string()).into_ascii(), vec2ascii![40, 32, 59]); assert_eq!((box [40u8, 32u8, 59u8]).into_ascii(), vec2ascii![40, 32, 59]); } @@ -634,8 +634,8 @@ mod tests { #[test] fn test_ascii_into_str() { - assert_eq!(vec2ascii![40, 32, 59].into_str(), "( ;".to_strbuf()); - assert_eq!(vec2ascii!(40, 32, 59).into_str(), "( ;".to_strbuf()); + assert_eq!(vec2ascii![40, 32, 59].into_str(), "( ;".to_string()); + assert_eq!(vec2ascii!(40, 32, 59).into_str(), "( ;".to_string()); } #[test] @@ -682,70 +682,70 @@ mod tests { assert_eq!((vec![40u8, 32u8, 59u8]).into_ascii_opt(), Some(vec2ascii![40, 32, 59])); assert_eq!((vec![127u8, 128u8, 255u8]).into_ascii_opt(), None); - assert_eq!(("( ;".to_strbuf()).into_ascii_opt(), Some(vec2ascii![40, 32, 59])); - assert_eq!(("zoä华".to_strbuf()).into_ascii_opt(), None); + assert_eq!(("( ;".to_string()).into_ascii_opt(), Some(vec2ascii![40, 32, 59])); + assert_eq!(("zoä华".to_string()).into_ascii_opt(), None); } #[test] fn test_to_ascii_upper() { - assert_eq!("url()URL()uRl()ürl".to_ascii_upper(), "URL()URL()URL()üRL".to_strbuf()); - assert_eq!("hıKß".to_ascii_upper(), "HıKß".to_strbuf()); + assert_eq!("url()URL()uRl()ürl".to_ascii_upper(), "URL()URL()URL()üRL".to_string()); + assert_eq!("hıKß".to_ascii_upper(), "HıKß".to_string()); let mut i = 0; while i <= 500 { let upper = if 'a' as u32 <= i && i <= 'z' as u32 { i + 'A' as u32 - 'a' as u32 } else { i }; assert_eq!(from_char(from_u32(i).unwrap()).as_slice().to_ascii_upper(), - from_char(from_u32(upper).unwrap()).to_strbuf()) + from_char(from_u32(upper).unwrap()).to_string()) i += 1; } } #[test] fn test_to_ascii_lower() { - assert_eq!("url()URL()uRl()Ürl".to_ascii_lower(), "url()url()url()Ürl".to_strbuf()); + assert_eq!("url()URL()uRl()Ürl".to_ascii_lower(), "url()url()url()Ürl".to_string()); // Dotted capital I, Kelvin sign, Sharp S. - assert_eq!("HİKß".to_ascii_lower(), "hİKß".to_strbuf()); + assert_eq!("HİKß".to_ascii_lower(), "hİKß".to_string()); let mut i = 0; while i <= 500 { let lower = if 'A' as u32 <= i && i <= 'Z' as u32 { i + 'a' as u32 - 'A' as u32 } else { i }; assert_eq!(from_char(from_u32(i).unwrap()).as_slice().to_ascii_lower(), - from_char(from_u32(lower).unwrap()).to_strbuf()) + from_char(from_u32(lower).unwrap()).to_string()) i += 1; } } #[test] fn test_into_ascii_upper() { - assert_eq!(("url()URL()uRl()ürl".to_strbuf()).into_ascii_upper(), - "URL()URL()URL()üRL".to_strbuf()); - assert_eq!(("hıKß".to_strbuf()).into_ascii_upper(), "HıKß".to_strbuf()); + assert_eq!(("url()URL()uRl()ürl".to_string()).into_ascii_upper(), + "URL()URL()URL()üRL".to_string()); + assert_eq!(("hıKß".to_string()).into_ascii_upper(), "HıKß".to_string()); let mut i = 0; while i <= 500 { let upper = if 'a' as u32 <= i && i <= 'z' as u32 { i + 'A' as u32 - 'a' as u32 } else { i }; - assert_eq!(from_char(from_u32(i).unwrap()).to_strbuf().into_ascii_upper(), - from_char(from_u32(upper).unwrap()).to_strbuf()) + assert_eq!(from_char(from_u32(i).unwrap()).to_string().into_ascii_upper(), + from_char(from_u32(upper).unwrap()).to_string()) i += 1; } } #[test] fn test_into_ascii_lower() { - assert_eq!(("url()URL()uRl()Ürl".to_strbuf()).into_ascii_lower(), - "url()url()url()Ürl".to_strbuf()); + assert_eq!(("url()URL()uRl()Ürl".to_string()).into_ascii_lower(), + "url()url()url()Ürl".to_string()); // Dotted capital I, Kelvin sign, Sharp S. - assert_eq!(("HİKß".to_strbuf()).into_ascii_lower(), "hİKß".to_strbuf()); + assert_eq!(("HİKß".to_string()).into_ascii_lower(), "hİKß".to_string()); let mut i = 0; while i <= 500 { let lower = if 'A' as u32 <= i && i <= 'Z' as u32 { i + 'a' as u32 - 'A' as u32 } else { i }; - assert_eq!(from_char(from_u32(i).unwrap()).to_strbuf().into_ascii_lower(), - from_char(from_u32(lower).unwrap()).to_strbuf()) + assert_eq!(from_char(from_u32(i).unwrap()).to_string().into_ascii_lower(), + from_char(from_u32(lower).unwrap()).to_string()) i += 1; } } @@ -777,12 +777,12 @@ mod tests { #[test] fn test_to_str() { let s = Ascii{ chr: 't' as u8 }.to_str(); - assert_eq!(s, "t".to_strbuf()); + assert_eq!(s, "t".to_string()); } #[test] fn test_show() { let c = Ascii { chr: 't' as u8 }; - assert_eq!(format_strbuf!("{}", c), "t".to_strbuf()); + assert_eq!(format_strbuf!("{}", c), "t".to_string()); } } diff --git a/src/libstd/fmt.rs b/src/libstd/fmt.rs index 174ea00d286..ba2bc261bc3 100644 --- a/src/libstd/fmt.rs +++ b/src/libstd/fmt.rs @@ -548,14 +548,14 @@ pub trait Poly { pub fn format(args: &Arguments) -> string::String{ let mut output = io::MemWriter::new(); let _ = write!(&mut output, "{}", args); - str::from_utf8(output.unwrap().as_slice()).unwrap().into_strbuf() + str::from_utf8(output.unwrap().as_slice()).unwrap().into_string() } /// Temporary transition utility pub fn format_strbuf(args: &Arguments) -> string::String { let mut output = io::MemWriter::new(); let _ = write!(&mut output, "{}", args); - str::from_utf8(output.unwrap().as_slice()).unwrap().into_strbuf() + str::from_utf8(output.unwrap().as_slice()).unwrap().into_string() } impl<T> Poly for T { diff --git a/src/libstd/io/buffered.rs b/src/libstd/io/buffered.rs index c7b0d660624..643bc166c27 100644 --- a/src/libstd/io/buffered.rs +++ b/src/libstd/io/buffered.rs @@ -537,9 +537,9 @@ mod test { fn test_read_line() { let in_buf = MemReader::new(Vec::from_slice(bytes!("a\nb\nc"))); let mut reader = BufferedReader::with_capacity(2, in_buf); - assert_eq!(reader.read_line(), Ok("a\n".to_strbuf())); - assert_eq!(reader.read_line(), Ok("b\n".to_strbuf())); - assert_eq!(reader.read_line(), Ok("c".to_strbuf())); + assert_eq!(reader.read_line(), Ok("a\n".to_string())); + assert_eq!(reader.read_line(), Ok("b\n".to_string())); + assert_eq!(reader.read_line(), Ok("c".to_string())); assert!(reader.read_line().is_err()); } @@ -548,9 +548,9 @@ mod test { let in_buf = MemReader::new(Vec::from_slice(bytes!("a\nb\nc"))); let mut reader = BufferedReader::with_capacity(2, in_buf); let mut it = reader.lines(); - assert_eq!(it.next(), Some(Ok("a\n".to_strbuf()))); - assert_eq!(it.next(), Some(Ok("b\n".to_strbuf()))); - assert_eq!(it.next(), Some(Ok("c".to_strbuf()))); + assert_eq!(it.next(), Some(Ok("a\n".to_string()))); + assert_eq!(it.next(), Some(Ok("b\n".to_string()))); + assert_eq!(it.next(), Some(Ok("c".to_string()))); assert_eq!(it.next(), None); } diff --git a/src/libstd/io/mem.rs b/src/libstd/io/mem.rs index c1e228cd693..735966d812b 100644 --- a/src/libstd/io/mem.rs +++ b/src/libstd/io/mem.rs @@ -497,7 +497,7 @@ mod test { writer.write_line("testing").unwrap(); writer.write_str("testing").unwrap(); let mut r = BufReader::new(writer.get_ref()); - assert_eq!(r.read_to_str().unwrap(), "testingtesting\ntesting".to_strbuf()); + assert_eq!(r.read_to_str().unwrap(), "testingtesting\ntesting".to_string()); } #[test] @@ -507,7 +507,7 @@ mod test { writer.write_char('\n').unwrap(); writer.write_char('ệ').unwrap(); let mut r = BufReader::new(writer.get_ref()); - assert_eq!(r.read_to_str().unwrap(), "a\nệ".to_strbuf()); + assert_eq!(r.read_to_str().unwrap(), "a\nệ".to_string()); } #[test] diff --git a/src/libstd/io/mod.rs b/src/libstd/io/mod.rs index c16c7737357..4d02a470f30 100644 --- a/src/libstd/io/mod.rs +++ b/src/libstd/io/mod.rs @@ -496,7 +496,7 @@ pub trait Reader { fn read_at_least(&mut self, min: uint, buf: &mut [u8]) -> IoResult<uint> { if min > buf.len() { return Err(IoError { - detail: Some("the buffer is too short".to_strbuf()), + detail: Some("the buffer is too short".to_string()), ..standard_error(InvalidInput) }); } @@ -564,7 +564,7 @@ pub trait Reader { fn push_at_least(&mut self, min: uint, len: uint, buf: &mut Vec<u8>) -> IoResult<uint> { if min > len { return Err(IoError { - detail: Some("the buffer is too short".to_strbuf()), + detail: Some("the buffer is too short".to_string()), ..standard_error(InvalidInput) }); } @@ -635,7 +635,7 @@ pub trait Reader { fn read_to_str(&mut self) -> IoResult<String> { self.read_to_end().and_then(|s| { match str::from_utf8(s.as_slice()) { - Some(s) => Ok(s.to_strbuf()), + Some(s) => Ok(s.to_string()), None => Err(standard_error(InvalidInput)), } }) @@ -1333,7 +1333,7 @@ pub trait Buffer: Reader { fn read_line(&mut self) -> IoResult<String> { self.read_until('\n' as u8).and_then(|line| match str::from_utf8(line.as_slice()) { - Some(s) => Ok(s.to_strbuf()), + Some(s) => Ok(s.to_string()), None => Err(standard_error(InvalidInput)), } ) diff --git a/src/libstd/io/net/ip.rs b/src/libstd/io/net/ip.rs index 4bf71b5480e..5004e8a5a07 100644 --- a/src/libstd/io/net/ip.rs +++ b/src/libstd/io/net/ip.rs @@ -445,8 +445,8 @@ mod test { #[test] fn ipv6_addr_to_str() { let a1 = Ipv6Addr(0, 0, 0, 0, 0, 0xffff, 0xc000, 0x280); - assert!(a1.to_str() == "::ffff:192.0.2.128".to_strbuf() || - a1.to_str() == "::FFFF:192.0.2.128".to_strbuf()); - assert_eq!(Ipv6Addr(8, 9, 10, 11, 12, 13, 14, 15).to_str(), "8:9:a:b:c:d:e:f".to_strbuf()); + assert!(a1.to_str() == "::ffff:192.0.2.128".to_string() || + a1.to_str() == "::FFFF:192.0.2.128".to_string()); + assert_eq!(Ipv6Addr(8, 9, 10, 11, 12, 13, 14, 15).to_str(), "8:9:a:b:c:d:e:f".to_string()); } } diff --git a/src/libstd/io/process.rs b/src/libstd/io/process.rs index 7eb495a6f68..20d20a14f9a 100644 --- a/src/libstd/io/process.rs +++ b/src/libstd/io/process.rs @@ -601,7 +601,7 @@ mod tests { iotest!(fn stdout_works() { let mut cmd = Command::new("echo"); cmd.arg("foobar").stdout(CreatePipe(false, true)); - assert_eq!(run_output(cmd), "foobar\n".to_strbuf()); + assert_eq!(run_output(cmd), "foobar\n".to_string()); }) #[cfg(unix, not(target_os="android"))] @@ -610,7 +610,7 @@ mod tests { cmd.arg("-c").arg("pwd") .cwd(&Path::new("/")) .stdout(CreatePipe(false, true)); - assert_eq!(run_output(cmd), "/\n".to_strbuf()); + assert_eq!(run_output(cmd), "/\n".to_string()); }) #[cfg(unix, not(target_os="android"))] @@ -624,7 +624,7 @@ mod tests { drop(p.stdin.take()); let out = read_all(p.stdout.get_mut_ref() as &mut Reader); assert!(p.wait().unwrap().success()); - assert_eq!(out, "foobar\n".to_strbuf()); + assert_eq!(out, "foobar\n".to_string()); }) #[cfg(not(target_os="android"))] @@ -682,7 +682,7 @@ mod tests { let output_str = str::from_utf8(output.as_slice()).unwrap(); assert!(status.success()); - assert_eq!(output_str.trim().to_strbuf(), "hello".to_strbuf()); + assert_eq!(output_str.trim().to_string(), "hello".to_string()); // FIXME #7224 if !running_on_valgrind() { assert_eq!(error, Vec::new()); @@ -719,7 +719,7 @@ mod tests { let output_str = str::from_utf8(output.as_slice()).unwrap(); assert!(status.success()); - assert_eq!(output_str.trim().to_strbuf(), "hello".to_strbuf()); + assert_eq!(output_str.trim().to_string(), "hello".to_string()); // FIXME #7224 if !running_on_valgrind() { assert_eq!(error, Vec::new()); @@ -749,7 +749,7 @@ mod tests { let prog = pwd_cmd().spawn().unwrap(); let output = str::from_utf8(prog.wait_with_output().unwrap() - .output.as_slice()).unwrap().to_strbuf(); + .output.as_slice()).unwrap().to_string(); let parent_dir = os::getcwd(); let child_dir = Path::new(output.as_slice().trim()); @@ -768,8 +768,8 @@ mod tests { let prog = pwd_cmd().cwd(&parent_dir).spawn().unwrap(); let output = str::from_utf8(prog.wait_with_output().unwrap() - .output.as_slice()).unwrap().to_strbuf(); - let child_dir = Path::new(output.as_slice().trim().into_strbuf()); + .output.as_slice()).unwrap().to_string(); + let child_dir = Path::new(output.as_slice().trim().into_string()); let parent_stat = parent_dir.stat().unwrap(); let child_stat = child_dir.stat().unwrap(); @@ -803,7 +803,7 @@ mod tests { let prog = env_cmd().spawn().unwrap(); let output = str::from_utf8(prog.wait_with_output().unwrap() - .output.as_slice()).unwrap().to_strbuf(); + .output.as_slice()).unwrap().to_string(); let r = os::env(); for &(ref k, ref v) in r.iter() { @@ -821,12 +821,12 @@ mod tests { let mut prog = env_cmd().spawn().unwrap(); let output = str::from_utf8(prog.wait_with_output() .unwrap().output.as_slice()) - .unwrap().to_strbuf(); + .unwrap().to_string(); let r = os::env(); for &(ref k, ref v) in r.iter() { // don't check android RANDOM variables - if *k != "RANDOM".to_strbuf() { + if *k != "RANDOM".to_string() { assert!(output.as_slice() .contains(format!("{}={}", *k, @@ -843,7 +843,7 @@ mod tests { let new_env = box [("RUN_TEST_NEW_ENV", "123")]; let prog = env_cmd().env(new_env).spawn().unwrap(); let result = prog.wait_with_output().unwrap(); - let output = str::from_utf8_lossy(result.output.as_slice()).into_strbuf(); + let output = str::from_utf8_lossy(result.output.as_slice()).into_string(); assert!(output.as_slice().contains("RUN_TEST_NEW_ENV=123"), "didn't find RUN_TEST_NEW_ENV inside of:\n\n{}", output); diff --git a/src/libstd/io/stdio.rs b/src/libstd/io/stdio.rs index ab7001cbc9a..6de4c6316d1 100644 --- a/src/libstd/io/stdio.rs +++ b/src/libstd/io/stdio.rs @@ -409,7 +409,7 @@ mod tests { set_stdout(box w); println!("hello!"); }); - assert_eq!(r.read_to_str().unwrap(), "hello!\n".to_strbuf()); + assert_eq!(r.read_to_str().unwrap(), "hello!\n".to_string()); }) iotest!(fn capture_stderr() { diff --git a/src/libstd/local_data.rs b/src/libstd/local_data.rs index 2412e18bf62..7bf0b19407f 100644 --- a/src/libstd/local_data.rs +++ b/src/libstd/local_data.rs @@ -277,11 +277,11 @@ mod tests { #[test] fn test_tls_multitask() { static my_key: Key<String> = &Key; - my_key.replace(Some("parent data".to_strbuf())); + my_key.replace(Some("parent data".to_string())); task::spawn(proc() { // TLS shouldn't carry over. assert!(my_key.get().is_none()); - my_key.replace(Some("child data".to_strbuf())); + my_key.replace(Some("child data".to_string())); assert!(my_key.get().get_ref().as_slice() == "child data"); // should be cleaned up for us }); @@ -295,16 +295,16 @@ mod tests { #[test] fn test_tls_overwrite() { static my_key: Key<String> = &Key; - my_key.replace(Some("first data".to_strbuf())); - my_key.replace(Some("next data".to_strbuf())); // Shouldn't leak. + my_key.replace(Some("first data".to_string())); + my_key.replace(Some("next data".to_string())); // Shouldn't leak. assert!(my_key.get().unwrap().as_slice() == "next data"); } #[test] fn test_tls_pop() { static my_key: Key<String> = &Key; - my_key.replace(Some("weasel".to_strbuf())); - assert!(my_key.replace(None).unwrap() == "weasel".to_strbuf()); + my_key.replace(Some("weasel".to_string())); + assert!(my_key.replace(None).unwrap() == "weasel".to_string()); // Pop must remove the data from the map. assert!(my_key.replace(None).is_none()); } @@ -319,7 +319,7 @@ mod tests { // a stack smaller than 1 MB. static my_key: Key<String> = &Key; task::spawn(proc() { - my_key.replace(Some("hax".to_strbuf())); + my_key.replace(Some("hax".to_string())); }); } @@ -329,7 +329,7 @@ mod tests { static box_key: Key<@()> = &Key; static int_key: Key<int> = &Key; task::spawn(proc() { - str_key.replace(Some("string data".to_strbuf())); + str_key.replace(Some("string data".to_string())); box_key.replace(Some(@())); int_key.replace(Some(42)); }); @@ -341,8 +341,8 @@ mod tests { static box_key: Key<@()> = &Key; static int_key: Key<int> = &Key; task::spawn(proc() { - str_key.replace(Some("string data".to_strbuf())); - str_key.replace(Some("string data 2".to_strbuf())); + str_key.replace(Some("string data".to_string())); + str_key.replace(Some("string data 2".to_string())); box_key.replace(Some(@())); box_key.replace(Some(@())); int_key.replace(Some(42)); @@ -359,10 +359,10 @@ mod tests { static str_key: Key<String> = &Key; static box_key: Key<@()> = &Key; static int_key: Key<int> = &Key; - str_key.replace(Some("parent data".to_strbuf())); + str_key.replace(Some("parent data".to_string())); box_key.replace(Some(@())); task::spawn(proc() { - str_key.replace(Some("string data".to_strbuf())); + str_key.replace(Some("string data".to_string())); box_key.replace(Some(@())); int_key.replace(Some(42)); fail!(); diff --git a/src/libstd/num/int_macros.rs b/src/libstd/num/int_macros.rs index 4456c8124ba..7ed00e3dd9d 100644 --- a/src/libstd/num/int_macros.rs +++ b/src/libstd/num/int_macros.rs @@ -136,39 +136,39 @@ mod tests { #[test] fn test_to_str() { - assert_eq!((0 as $T).to_str_radix(10u), "0".to_strbuf()); - assert_eq!((1 as $T).to_str_radix(10u), "1".to_strbuf()); - assert_eq!((-1 as $T).to_str_radix(10u), "-1".to_strbuf()); - assert_eq!((127 as $T).to_str_radix(16u), "7f".to_strbuf()); - assert_eq!((100 as $T).to_str_radix(10u), "100".to_strbuf()); + assert_eq!((0 as $T).to_str_radix(10u), "0".to_string()); + assert_eq!((1 as $T).to_str_radix(10u), "1".to_string()); + assert_eq!((-1 as $T).to_str_radix(10u), "-1".to_string()); + assert_eq!((127 as $T).to_str_radix(16u), "7f".to_string()); + assert_eq!((100 as $T).to_str_radix(10u), "100".to_string()); } #[test] fn test_int_to_str_overflow() { let mut i8_val: i8 = 127_i8; - assert_eq!(i8_val.to_str(), "127".to_strbuf()); + assert_eq!(i8_val.to_str(), "127".to_string()); i8_val += 1 as i8; - assert_eq!(i8_val.to_str(), "-128".to_strbuf()); + assert_eq!(i8_val.to_str(), "-128".to_string()); let mut i16_val: i16 = 32_767_i16; - assert_eq!(i16_val.to_str(), "32767".to_strbuf()); + assert_eq!(i16_val.to_str(), "32767".to_string()); i16_val += 1 as i16; - assert_eq!(i16_val.to_str(), "-32768".to_strbuf()); + assert_eq!(i16_val.to_str(), "-32768".to_string()); let mut i32_val: i32 = 2_147_483_647_i32; - assert_eq!(i32_val.to_str(), "2147483647".to_strbuf()); + assert_eq!(i32_val.to_str(), "2147483647".to_string()); i32_val += 1 as i32; - assert_eq!(i32_val.to_str(), "-2147483648".to_strbuf()); + assert_eq!(i32_val.to_str(), "-2147483648".to_string()); let mut i64_val: i64 = 9_223_372_036_854_775_807_i64; - assert_eq!(i64_val.to_str(), "9223372036854775807".to_strbuf()); + assert_eq!(i64_val.to_str(), "9223372036854775807".to_string()); i64_val += 1 as i64; - assert_eq!(i64_val.to_str(), "-9223372036854775808".to_strbuf()); + assert_eq!(i64_val.to_str(), "-9223372036854775808".to_string()); } #[test] diff --git a/src/libstd/num/uint_macros.rs b/src/libstd/num/uint_macros.rs index e59e638faa9..43048453717 100644 --- a/src/libstd/num/uint_macros.rs +++ b/src/libstd/num/uint_macros.rs @@ -94,13 +94,13 @@ mod tests { #[test] pub fn test_to_str() { - assert_eq!((0 as $T).to_str_radix(10u), "0".to_strbuf()); - assert_eq!((1 as $T).to_str_radix(10u), "1".to_strbuf()); - assert_eq!((2 as $T).to_str_radix(10u), "2".to_strbuf()); - assert_eq!((11 as $T).to_str_radix(10u), "11".to_strbuf()); - assert_eq!((11 as $T).to_str_radix(16u), "b".to_strbuf()); - assert_eq!((255 as $T).to_str_radix(16u), "ff".to_strbuf()); - assert_eq!((0xff as $T).to_str_radix(10u), "255".to_strbuf()); + assert_eq!((0 as $T).to_str_radix(10u), "0".to_string()); + assert_eq!((1 as $T).to_str_radix(10u), "1".to_string()); + assert_eq!((2 as $T).to_str_radix(10u), "2".to_string()); + assert_eq!((11 as $T).to_str_radix(10u), "11".to_string()); + assert_eq!((11 as $T).to_str_radix(16u), "b".to_string()); + assert_eq!((255 as $T).to_str_radix(16u), "ff".to_string()); + assert_eq!((0xff as $T).to_str_radix(10u), "255".to_string()); } #[test] @@ -133,28 +133,28 @@ mod tests { #[test] fn test_uint_to_str_overflow() { let mut u8_val: u8 = 255_u8; - assert_eq!(u8_val.to_str(), "255".to_strbuf()); + assert_eq!(u8_val.to_str(), "255".to_string()); u8_val += 1 as u8; - assert_eq!(u8_val.to_str(), "0".to_strbuf()); + assert_eq!(u8_val.to_str(), "0".to_string()); let mut u16_val: u16 = 65_535_u16; - assert_eq!(u16_val.to_str(), "65535".to_strbuf()); + assert_eq!(u16_val.to_str(), "65535".to_string()); u16_val += 1 as u16; - assert_eq!(u16_val.to_str(), "0".to_strbuf()); + assert_eq!(u16_val.to_str(), "0".to_string()); let mut u32_val: u32 = 4_294_967_295_u32; - assert_eq!(u32_val.to_str(), "4294967295".to_strbuf()); + assert_eq!(u32_val.to_str(), "4294967295".to_string()); u32_val += 1 as u32; - assert_eq!(u32_val.to_str(), "0".to_strbuf()); + assert_eq!(u32_val.to_str(), "0".to_string()); let mut u64_val: u64 = 18_446_744_073_709_551_615_u64; - assert_eq!(u64_val.to_str(), "18446744073709551615".to_strbuf()); + assert_eq!(u64_val.to_str(), "18446744073709551615".to_string()); u64_val += 1 as u64; - assert_eq!(u64_val.to_str(), "0".to_strbuf()); + assert_eq!(u64_val.to_str(), "0".to_string()); } #[test] diff --git a/src/libstd/os.rs b/src/libstd/os.rs index dbddee8fce2..7d3758d621d 100644 --- a/src/libstd/os.rs +++ b/src/libstd/os.rs @@ -178,8 +178,8 @@ fn with_env_lock<T>(f: || -> T) -> T { /// for details. pub fn env() -> Vec<(String,String)> { env_as_bytes().move_iter().map(|(k,v)| { - let k = str::from_utf8_lossy(k.as_slice()).to_strbuf(); - let v = str::from_utf8_lossy(v.as_slice()).to_strbuf(); + let k = str::from_utf8_lossy(k.as_slice()).to_string(); + let v = str::from_utf8_lossy(v.as_slice()).to_string(); (k,v) }).collect() } @@ -277,7 +277,7 @@ pub fn env_as_bytes() -> Vec<(Vec<u8>,Vec<u8>)> { /// /// Fails if `n` has any interior NULs. pub fn getenv(n: &str) -> Option<String> { - getenv_as_bytes(n).map(|v| str::from_utf8_lossy(v.as_slice()).to_strbuf()) + getenv_as_bytes(n).map(|v| str::from_utf8_lossy(v.as_slice()).to_string()) } #[cfg(unix)] @@ -503,7 +503,7 @@ pub fn self_exe_name() -> Option<Path> { use os::win32::fill_utf16_buf_and_decode; fill_utf16_buf_and_decode(|buf, sz| { libc::GetModuleFileNameW(0u as libc::DWORD, buf, sz) - }).map(|s| s.into_strbuf().into_bytes()) + }).map(|s| s.into_string().into_bytes()) } } @@ -736,7 +736,7 @@ pub fn error_string(errnum: uint) -> String { fail!("strerror_r failure"); } - str::raw::from_c_str(p as *c_char).into_strbuf() + str::raw::from_c_str(p as *c_char).into_string() } } @@ -859,7 +859,7 @@ fn real_args_as_bytes() -> Vec<Vec<u8>> { fn real_args() -> Vec<String> { real_args_as_bytes().move_iter() .map(|v| { - str::from_utf8_lossy(v.as_slice()).into_strbuf() + str::from_utf8_lossy(v.as_slice()).into_string() }).collect() } @@ -1522,7 +1522,7 @@ mod tests { fn test_setenv() { let n = make_rand_name(); setenv(n.as_slice(), "VALUE"); - assert_eq!(getenv(n.as_slice()), option::Some("VALUE".to_strbuf())); + assert_eq!(getenv(n.as_slice()), option::Some("VALUE".to_string())); } #[test] @@ -1539,9 +1539,9 @@ mod tests { let n = make_rand_name(); setenv(n.as_slice(), "1"); setenv(n.as_slice(), "2"); - assert_eq!(getenv(n.as_slice()), option::Some("2".to_strbuf())); + assert_eq!(getenv(n.as_slice()), option::Some("2".to_string())); setenv(n.as_slice(), ""); - assert_eq!(getenv(n.as_slice()), option::Some("".to_strbuf())); + assert_eq!(getenv(n.as_slice()), option::Some("".to_string())); } // Windows GetEnvironmentVariable requires some extra work to make sure @@ -1549,7 +1549,7 @@ mod tests { #[test] #[ignore] fn test_getenv_big() { - let mut s = "".to_strbuf(); + let mut s = "".to_string(); let mut i = 0; while i < 100 { s.push_str("aaaaaaaaaa"); @@ -1602,7 +1602,7 @@ mod tests { #[test] fn test_env_set_get_huge() { let n = make_rand_name(); - let s = "x".repeat(10000).to_strbuf(); + let s = "x".repeat(10000).to_string(); setenv(n.as_slice(), s.as_slice()); assert_eq!(getenv(n.as_slice()), Some(s)); unsetenv(n.as_slice()); @@ -1615,10 +1615,10 @@ mod tests { let mut e = env(); setenv(n.as_slice(), "VALUE"); - assert!(!e.contains(&(n.clone(), "VALUE".to_strbuf()))); + assert!(!e.contains(&(n.clone(), "VALUE".to_string()))); e = env(); - assert!(e.contains(&(n, "VALUE".to_strbuf()))); + assert!(e.contains(&(n, "VALUE".to_string()))); } #[test] diff --git a/src/libstd/path/posix.rs b/src/libstd/path/posix.rs index 011ed287215..c0c7a042f11 100644 --- a/src/libstd/path/posix.rs +++ b/src/libstd/path/posix.rs @@ -761,7 +761,7 @@ mod tests { t!(s: "a/b/c", ["d", "e"], "a/b/c/d/e"); t!(s: "a/b/c", ["d", "/e"], "/e"); t!(s: "a/b/c", ["d", "/e", "f"], "/e/f"); - t!(s: "a/b/c", ["d".to_strbuf(), "e".to_strbuf()], "a/b/c/d/e"); + t!(s: "a/b/c", ["d".to_string(), "e".to_string()], "a/b/c/d/e"); t!(v: b!("a/b/c"), [b!("d"), b!("e")], b!("a/b/c/d/e")); t!(v: b!("a/b/c"), [b!("d"), b!("/e"), b!("f")], b!("/e/f")); t!(v: b!("a/b/c"), [Vec::from_slice(b!("d")), Vec::from_slice(b!("e"))], b!("a/b/c/d/e")); @@ -866,7 +866,7 @@ mod tests { t!(s: "a/b/c", ["d", "e"], "a/b/c/d/e"); t!(s: "a/b/c", ["..", "d"], "a/b/d"); t!(s: "a/b/c", ["d", "/e", "f"], "/e/f"); - t!(s: "a/b/c", ["d".to_strbuf(), "e".to_strbuf()], "a/b/c/d/e"); + t!(s: "a/b/c", ["d".to_string(), "e".to_string()], "a/b/c/d/e"); t!(v: b!("a/b/c"), [b!("d"), b!("e")], b!("a/b/c/d/e")); t!(v: b!("a/b/c"), [Vec::from_slice(b!("d")), Vec::from_slice(b!("e"))], b!("a/b/c/d/e")); } diff --git a/src/libstd/path/windows.rs b/src/libstd/path/windows.rs index 763883a159f..1fc2fa1d221 100644 --- a/src/libstd/path/windows.rs +++ b/src/libstd/path/windows.rs @@ -587,7 +587,7 @@ impl GenericPath for Path { } } } - Some(Path::new(comps.connect("\\").into_strbuf())) + Some(Path::new(comps.connect("\\").into_string())) } } @@ -695,7 +695,7 @@ impl Path { (prefix, path) }; (prefix, match val { - None => s.into_strbuf(), + None => s.into_string(), Some(val) => val }) } @@ -1318,9 +1318,9 @@ mod tests { #[test] fn test_display_str() { let path = Path::new("foo"); - assert_eq!(path.display().to_str(), "foo".to_strbuf()); + assert_eq!(path.display().to_str(), "foo".to_string()); let path = Path::new(b!("\\")); - assert_eq!(path.filename_display().to_str(), "".to_strbuf()); + assert_eq!(path.filename_display().to_str(), "".to_string()); let path = Path::new("foo"); let mo = path.display().as_maybe_owned(); @@ -1581,7 +1581,7 @@ mod tests { t!(s: "a\\b\\c", ["d", "e"], "a\\b\\c\\d\\e"); t!(s: "a\\b\\c", ["d", "\\e"], "\\e"); t!(s: "a\\b\\c", ["d", "\\e", "f"], "\\e\\f"); - t!(s: "a\\b\\c", ["d".to_strbuf(), "e".to_strbuf()], "a\\b\\c\\d\\e"); + t!(s: "a\\b\\c", ["d".to_string(), "e".to_string()], "a\\b\\c\\d\\e"); t!(v: b!("a\\b\\c"), [b!("d"), b!("e")], b!("a\\b\\c\\d\\e")); t!(v: b!("a\\b\\c"), [b!("d"), b!("\\e"), b!("f")], b!("\\e\\f")); t!(v: b!("a\\b\\c"), [Vec::from_slice(b!("d")), Vec::from_slice(b!("e"))], @@ -1722,7 +1722,7 @@ mod tests { t!(s: "a\\b\\c", ["d", "e"], "a\\b\\c\\d\\e"); t!(s: "a\\b\\c", ["..", "d"], "a\\b\\d"); t!(s: "a\\b\\c", ["d", "\\e", "f"], "\\e\\f"); - t!(s: "a\\b\\c", ["d".to_strbuf(), "e".to_strbuf()], "a\\b\\c\\d\\e"); + t!(s: "a\\b\\c", ["d".to_string(), "e".to_string()], "a\\b\\c\\d\\e"); t!(v: b!("a\\b\\c"), [b!("d"), b!("e")], b!("a\\b\\c\\d\\e")); t!(v: b!("a\\b\\c"), [Vec::from_slice(b!("d")), Vec::from_slice(b!("e"))], b!("a\\b\\c\\d\\e")); diff --git a/src/libstd/repr.rs b/src/libstd/repr.rs index d800232d3b8..969c20d8b55 100644 --- a/src/libstd/repr.rs +++ b/src/libstd/repr.rs @@ -609,7 +609,7 @@ pub fn repr_to_str<T>(t: &T) -> String { let mut result = io::MemWriter::new(); write_repr(&mut result as &mut io::Writer, t).unwrap(); - str::from_utf8(result.unwrap().as_slice()).unwrap().to_strbuf() + str::from_utf8(result.unwrap().as_slice()).unwrap().to_string() } #[cfg(test)] diff --git a/src/libstd/rt/task.rs b/src/libstd/rt/task.rs index cd59de8899a..7f492a00b80 100644 --- a/src/libstd/rt/task.rs +++ b/src/libstd/rt/task.rs @@ -421,10 +421,10 @@ mod test { #[test] fn tls() { local_data_key!(key: @String) - key.replace(Some(@"data".to_strbuf())); + key.replace(Some(@"data".to_string())); assert_eq!(key.get().unwrap().as_slice(), "data"); local_data_key!(key2: @String) - key2.replace(Some(@"data".to_strbuf())); + key2.replace(Some(@"data".to_string())); assert_eq!(key2.get().unwrap().as_slice(), "data"); } diff --git a/src/libstd/slice.rs b/src/libstd/slice.rs index ca75f33f0fe..e5c0cc3babd 100644 --- a/src/libstd/slice.rs +++ b/src/libstd/slice.rs @@ -1839,18 +1839,18 @@ mod tests { }) ) let empty: ~[int] = box []; - test_show_vec!(empty, "[]".to_strbuf()); - test_show_vec!(box [1], "[1]".to_strbuf()); - test_show_vec!(box [1, 2, 3], "[1, 2, 3]".to_strbuf()); + test_show_vec!(empty, "[]".to_string()); + test_show_vec!(box [1], "[1]".to_string()); + test_show_vec!(box [1, 2, 3], "[1, 2, 3]".to_string()); test_show_vec!(box [box [], box [1u], box [1u, 1u]], - "[[], [1], [1, 1]]".to_strbuf()); + "[[], [1], [1, 1]]".to_string()); let empty_mut: &mut [int] = &mut[]; - test_show_vec!(empty_mut, "[]".to_strbuf()); - test_show_vec!(&mut[1], "[1]".to_strbuf()); - test_show_vec!(&mut[1, 2, 3], "[1, 2, 3]".to_strbuf()); + test_show_vec!(empty_mut, "[]".to_string()); + test_show_vec!(&mut[1], "[1]".to_string()); + test_show_vec!(&mut[1, 2, 3], "[1, 2, 3]".to_string()); test_show_vec!(&mut[&mut[], &mut[1u], &mut[1u, 1u]], - "[[], [1], [1, 1]]".to_strbuf()); + "[[], [1], [1, 1]]".to_string()); } #[test] diff --git a/src/libstd/str.rs b/src/libstd/str.rs index 988c029c9b9..bbb89ccd801 100644 --- a/src/libstd/str.rs +++ b/src/libstd/str.rs @@ -726,13 +726,13 @@ pub trait StrAllocating: Str { /// Convert `self` into a `String`. #[inline] - fn to_strbuf(&self) -> String { + fn to_string(&self) -> String { String::from_str(self.as_slice()) } /// Convert `self` into a `String`, not making a copy if possible. #[inline] - fn into_strbuf(self) -> String { + fn into_string(self) -> String { self.into_owned() } @@ -1009,7 +1009,7 @@ mod tests { assert!(data.slice(2u, 4u).find_str("ab").is_none()); let string = "ประเทศไทย中华Việt Nam"; - let mut data = string.to_strbuf(); + let mut data = string.to_string(); data.push_str(string); assert!(data.as_slice().find_str("ไท华").is_none()); assert_eq!(data.as_slice().slice(0u, 43u).find_str(""), Some(0u)); @@ -1532,10 +1532,10 @@ mod tests { #[test] fn vec_str_conversions() { - let s1: String = "All mimsy were the borogoves".to_strbuf(); + let s1: String = "All mimsy were the borogoves".to_string(); let v: Vec<u8> = Vec::from_slice(s1.as_bytes()); - let s2: String = from_utf8(v.as_slice()).unwrap().to_strbuf(); + let s2: String = from_utf8(v.as_slice()).unwrap().to_string(); let mut i: uint = 0u; let n1: uint = s1.len(); let n2: uint = v.len(); @@ -1968,30 +1968,30 @@ mod tests { #[test] fn test_nfd_chars() { - assert_eq!("abc".nfd_chars().collect::<String>(), "abc".to_strbuf()); - assert_eq!("\u1e0b\u01c4".nfd_chars().collect::<String>(), "d\u0307\u01c4".to_strbuf()); - assert_eq!("\u2026".nfd_chars().collect::<String>(), "\u2026".to_strbuf()); - assert_eq!("\u2126".nfd_chars().collect::<String>(), "\u03a9".to_strbuf()); - assert_eq!("\u1e0b\u0323".nfd_chars().collect::<String>(), "d\u0323\u0307".to_strbuf()); - assert_eq!("\u1e0d\u0307".nfd_chars().collect::<String>(), "d\u0323\u0307".to_strbuf()); - assert_eq!("a\u0301".nfd_chars().collect::<String>(), "a\u0301".to_strbuf()); - assert_eq!("\u0301a".nfd_chars().collect::<String>(), "\u0301a".to_strbuf()); - assert_eq!("\ud4db".nfd_chars().collect::<String>(), "\u1111\u1171\u11b6".to_strbuf()); - assert_eq!("\uac1c".nfd_chars().collect::<String>(), "\u1100\u1162".to_strbuf()); + assert_eq!("abc".nfd_chars().collect::<String>(), "abc".to_string()); + assert_eq!("\u1e0b\u01c4".nfd_chars().collect::<String>(), "d\u0307\u01c4".to_string()); + assert_eq!("\u2026".nfd_chars().collect::<String>(), "\u2026".to_string()); + assert_eq!("\u2126".nfd_chars().collect::<String>(), "\u03a9".to_string()); + assert_eq!("\u1e0b\u0323".nfd_chars().collect::<String>(), "d\u0323\u0307".to_string()); + assert_eq!("\u1e0d\u0307".nfd_chars().collect::<String>(), "d\u0323\u0307".to_string()); + assert_eq!("a\u0301".nfd_chars().collect::<String>(), "a\u0301".to_string()); + assert_eq!("\u0301a".nfd_chars().collect::<String>(), "\u0301a".to_string()); + assert_eq!("\ud4db".nfd_chars().collect::<String>(), "\u1111\u1171\u11b6".to_string()); + assert_eq!("\uac1c".nfd_chars().collect::<String>(), "\u1100\u1162".to_string()); } #[test] fn test_nfkd_chars() { - assert_eq!("abc".nfkd_chars().collect::<String>(), "abc".to_strbuf()); - assert_eq!("\u1e0b\u01c4".nfkd_chars().collect::<String>(), "d\u0307DZ\u030c".to_strbuf()); - assert_eq!("\u2026".nfkd_chars().collect::<String>(), "...".to_strbuf()); - assert_eq!("\u2126".nfkd_chars().collect::<String>(), "\u03a9".to_strbuf()); - assert_eq!("\u1e0b\u0323".nfkd_chars().collect::<String>(), "d\u0323\u0307".to_strbuf()); - assert_eq!("\u1e0d\u0307".nfkd_chars().collect::<String>(), "d\u0323\u0307".to_strbuf()); - assert_eq!("a\u0301".nfkd_chars().collect::<String>(), "a\u0301".to_strbuf()); - assert_eq!("\u0301a".nfkd_chars().collect::<String>(), "\u0301a".to_strbuf()); - assert_eq!("\ud4db".nfkd_chars().collect::<String>(), "\u1111\u1171\u11b6".to_strbuf()); - assert_eq!("\uac1c".nfkd_chars().collect::<String>(), "\u1100\u1162".to_strbuf()); + assert_eq!("abc".nfkd_chars().collect::<String>(), "abc".to_string()); + assert_eq!("\u1e0b\u01c4".nfkd_chars().collect::<String>(), "d\u0307DZ\u030c".to_string()); + assert_eq!("\u2026".nfkd_chars().collect::<String>(), "...".to_string()); + assert_eq!("\u2126".nfkd_chars().collect::<String>(), "\u03a9".to_string()); + assert_eq!("\u1e0b\u0323".nfkd_chars().collect::<String>(), "d\u0323\u0307".to_string()); + assert_eq!("\u1e0d\u0307".nfkd_chars().collect::<String>(), "d\u0323\u0307".to_string()); + assert_eq!("a\u0301".nfkd_chars().collect::<String>(), "a\u0301".to_string()); + assert_eq!("\u0301a".nfkd_chars().collect::<String>(), "\u0301a".to_string()); + assert_eq!("\ud4db".nfkd_chars().collect::<String>(), "\u1111\u1171\u11b6".to_string()); + assert_eq!("\uac1c".nfkd_chars().collect::<String>(), "\u1100\u1162".to_string()); } #[test] @@ -2113,7 +2113,7 @@ mod tests { #[test] fn test_from_str() { let owned: Option<String> = from_str("string"); - assert_eq!(owned, Some("string".to_strbuf())); + assert_eq!(owned, Some("string".to_string())); } #[test] @@ -2129,8 +2129,8 @@ mod tests { let o = Owned("abcde".to_string()); assert_eq!(o.len(), 5); assert_eq!(o.as_slice(), "abcde"); - assert_eq!(o.to_str(), "abcde".to_strbuf()); - assert_eq!(format_strbuf!("{}", o), "abcde".to_strbuf()); + assert_eq!(o.to_str(), "abcde".to_string()); + assert_eq!(format_strbuf!("{}", o), "abcde".to_string()); assert!(o.lt(&Slice("bcdef"))); assert_eq!(Owned("".to_string()), Default::default()); diff --git a/src/libstd/string.rs b/src/libstd/string.rs index 8897750df65..dce96cb2e8f 100644 --- a/src/libstd/string.rs +++ b/src/libstd/string.rs @@ -328,7 +328,7 @@ impl StrAllocating for String { } #[inline] - fn into_strbuf(self) -> String { + fn into_string(self) -> String { self } } @@ -362,7 +362,7 @@ impl<'a, S: Str> Equiv<S> for String { impl FromStr for String { #[inline] fn from_str(s: &str) -> Option<String> { - Some(s.to_strbuf()) + Some(s.to_string()) } } diff --git a/src/libstd/task.rs b/src/libstd/task.rs index 37244b26ad5..4824a956107 100644 --- a/src/libstd/task.rs +++ b/src/libstd/task.rs @@ -497,12 +497,12 @@ fn test_try_fail_message_static_str() { #[test] fn test_try_fail_message_owned_str() { match try(proc() { - fail!("owned string".to_strbuf()); + fail!("owned string".to_string()); }) { Err(e) => { type T = String; assert!(e.is::<T>()); - assert_eq!(*e.move::<T>().unwrap(), "owned string".to_strbuf()); + assert_eq!(*e.move::<T>().unwrap(), "owned string".to_string()); } Ok(()) => fail!() } diff --git a/src/libstd/to_str.rs b/src/libstd/to_str.rs index afc71ab88d9..c2100111e12 100644 --- a/src/libstd/to_str.rs +++ b/src/libstd/to_str.rs @@ -42,23 +42,23 @@ mod tests { #[test] fn test_simple_types() { - assert_eq!(1i.to_str(), "1".to_strbuf()); - assert_eq!((-1i).to_str(), "-1".to_strbuf()); - assert_eq!(200u.to_str(), "200".to_strbuf()); - assert_eq!(2u8.to_str(), "2".to_strbuf()); - assert_eq!(true.to_str(), "true".to_strbuf()); - assert_eq!(false.to_str(), "false".to_strbuf()); - assert_eq!(().to_str(), "()".to_strbuf()); - assert_eq!(("hi".to_strbuf()).to_str(), "hi".to_strbuf()); + assert_eq!(1i.to_str(), "1".to_string()); + assert_eq!((-1i).to_str(), "-1".to_string()); + assert_eq!(200u.to_str(), "200".to_string()); + assert_eq!(2u8.to_str(), "2".to_string()); + assert_eq!(true.to_str(), "true".to_string()); + assert_eq!(false.to_str(), "false".to_string()); + assert_eq!(().to_str(), "()".to_string()); + assert_eq!(("hi".to_string()).to_str(), "hi".to_string()); } #[test] fn test_vectors() { let x: ~[int] = box []; - assert_eq!(x.to_str(), "[]".to_strbuf()); - assert_eq!((box [1]).to_str(), "[1]".to_strbuf()); - assert_eq!((box [1, 2, 3]).to_str(), "[1, 2, 3]".to_strbuf()); + assert_eq!(x.to_str(), "[]".to_string()); + assert_eq!((box [1]).to_str(), "[1]".to_string()); + assert_eq!((box [1, 2, 3]).to_str(), "[1, 2, 3]".to_string()); assert!((box [box [], box [1], box [1, 1]]).to_str() == - "[[], [1], [1, 1]]".to_strbuf()); + "[[], [1], [1, 1]]".to_string()); } } diff --git a/src/libstd/unstable/dynamic_lib.rs b/src/libstd/unstable/dynamic_lib.rs index 6302ab39dd8..81eb51107ba 100644 --- a/src/libstd/unstable/dynamic_lib.rs +++ b/src/libstd/unstable/dynamic_lib.rs @@ -240,7 +240,7 @@ pub mod dl { } else { Err(CString::new(last_error, false).as_str() .unwrap() - .to_strbuf()) + .to_string()) }; ret diff --git a/src/libstd/vec.rs b/src/libstd/vec.rs index 24330584714..81f6c7c7c9b 100644 --- a/src/libstd/vec.rs +++ b/src/libstd/vec.rs @@ -1850,9 +1850,9 @@ mod tests { let b: ~[u8] = FromVec::from_vec(a); assert_eq!(b.as_slice(), &[]); - let a = vec!["one".to_strbuf(), "two".to_strbuf()]; + let a = vec!["one".to_string(), "two".to_string()]; let b: ~[String] = FromVec::from_vec(a); - assert_eq!(b.as_slice(), &["one".to_strbuf(), "two".to_strbuf()]); + assert_eq!(b.as_slice(), &["one".to_string(), "two".to_string()]); struct Foo { x: uint, |
