summary refs log tree commit diff
path: root/src/libstd/os.rs
diff options
context:
space:
mode:
authorHuon Wilson <dbau.pp+github@gmail.com>2013-06-10 00:44:58 +1000
committerHuon Wilson <dbau.pp+github@gmail.com>2013-06-10 23:02:54 +1000
commitc32fb53cf9ae20a657d17bd8e2f0b36863096583 (patch)
tree928280b4bfcde6b9765de76f956624a735eafde9 /src/libstd/os.rs
parentb29cd22bce6325a60788ab84f989bd2e82fcaaf4 (diff)
downloadrust-c32fb53cf9ae20a657d17bd8e2f0b36863096583.tar.gz
rust-c32fb53cf9ae20a657d17bd8e2f0b36863096583.zip
std: remove str::{len, slice, is_empty} in favour of methods.
Diffstat (limited to 'src/libstd/os.rs')
-rw-r--r--src/libstd/os.rs13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/libstd/os.rs b/src/libstd/os.rs
index 2069e61f11e..ab8965a6796 100644
--- a/src/libstd/os.rs
+++ b/src/libstd/os.rs
@@ -525,7 +525,7 @@ pub fn self_exe_path() -> Option<Path> {
  */
 pub fn homedir() -> Option<Path> {
     return match getenv("HOME") {
-        Some(ref p) => if !str::is_empty(*p) {
+        Some(ref p) => if !p.is_empty() {
           Some(Path(*p))
         } else {
           secondary()
@@ -541,7 +541,7 @@ pub fn homedir() -> Option<Path> {
     #[cfg(windows)]
     fn secondary() -> Option<Path> {
         do getenv(~"USERPROFILE").chain |p| {
-            if !str::is_empty(p) {
+            if !p.is_empty() {
                 Some(Path(p))
             } else {
                 None
@@ -566,7 +566,7 @@ pub fn tmpdir() -> Path {
     fn getenv_nonempty(v: &str) -> Option<Path> {
         match getenv(v) {
             Some(x) =>
-                if str::is_empty(x) {
+                if x.is_empty() {
                     None
                 } else {
                     Some(Path(x))
@@ -1449,6 +1449,7 @@ mod tests {
     use rand;
     use run;
     use str;
+    use str::StrSlice;
     use vec;
     use libc::consts::os::posix88::{S_IRUSR, S_IWUSR, S_IXUSR};
 
@@ -1606,7 +1607,7 @@ mod tests {
 
     #[test]
     fn tmpdir() {
-        assert!(!str::is_empty(os::tmpdir().to_str()));
+        assert!(!os::tmpdir().to_str().is_empty());
     }
 
     // Issue #712
@@ -1671,7 +1672,7 @@ mod tests {
         unsafe {
           let tempdir = getcwd(); // would like to use $TMPDIR,
                                   // doesn't seem to work on Linux
-          assert!((str::len(tempdir.to_str()) > 0u));
+          assert!((tempdir.to_str().len() > 0u));
           let in = tempdir.push("in.txt");
           let out = tempdir.push("out.txt");
 
@@ -1686,7 +1687,7 @@ mod tests {
           let mut buf = str::to_bytes(s) + [0 as u8];
           do vec::as_mut_buf(buf) |b, _len| {
               assert!((libc::fwrite(b as *c_void, 1u as size_t,
-                                   (str::len(s) + 1u) as size_t, ostream)
+                                   (s.len() + 1u) as size_t, ostream)
                       == buf.len() as size_t))
           }
           assert_eq!(libc::fclose(ostream), (0u as c_int));