about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--src/librand/lib.rs4
-rw-r--r--src/libregex/test/bench.rs2
-rw-r--r--src/libstd/os.rs6
3 files changed, 6 insertions, 6 deletions
diff --git a/src/librand/lib.rs b/src/librand/lib.rs
index 1f0dd9a407e..5b71d5c4da7 100644
--- a/src/librand/lib.rs
+++ b/src/librand/lib.rs
@@ -260,7 +260,7 @@ pub trait Rng {
     ///
     /// println!("{}", task_rng().gen_ascii_str(10));
     /// ```
-    fn gen_ascii_str(&mut self, len: uint) -> ~str {
+    fn gen_ascii_str(&mut self, len: uint) -> StrBuf {
         static GEN_ASCII_STR_CHARSET: &'static [u8] = bytes!("ABCDEFGHIJKLMNOPQRSTUVWXYZ\
                                                              abcdefghijklmnopqrstuvwxyz\
                                                              0123456789");
@@ -268,7 +268,7 @@ pub trait Rng {
         for _ in range(0, len) {
             s.push_char(self.choose(GEN_ASCII_STR_CHARSET) as char)
         }
-        s.into_owned()
+        s
     }
 
     /// Choose an item randomly, failing if `values` is empty.
diff --git a/src/libregex/test/bench.rs b/src/libregex/test/bench.rs
index 3630e0ebb5c..4c4ba8dd6bf 100644
--- a/src/libregex/test/bench.rs
+++ b/src/libregex/test/bench.rs
@@ -159,7 +159,7 @@ fn gen_text(n: uint) -> StrBuf {
             *b = '\n' as u8
         }
     }
-    str::from_utf8(bytes).unwrap().to_strbuf()
+    str::from_utf8(bytes.as_slice()).unwrap().to_strbuf()
 }
 
 throughput!(easy0_32, easy0(), 32)
diff --git a/src/libstd/os.rs b/src/libstd/os.rs
index 0a920a275ac..88081d90b40 100644
--- a/src/libstd/os.rs
+++ b/src/libstd/os.rs
@@ -1511,9 +1511,9 @@ mod tests {
 
     fn make_rand_name() -> ~str {
         let mut rng = rand::task_rng();
-        let n = "TEST".to_owned() + rng.gen_ascii_str(10u);
-        assert!(getenv(n).is_none());
-        n
+        let n = format_strbuf!("TEST{}", rng.gen_ascii_str(10u).as_slice());
+        assert!(getenv(n.as_slice()).is_none());
+        n.into_owned()
     }
 
     #[test]