summary refs log tree commit diff
path: root/src/libstd/path.rs
diff options
context:
space:
mode:
authorKevin Ballard <kevin@sb.org>2013-08-14 19:21:59 -0700
committerKevin Ballard <kevin@sb.org>2013-08-15 01:33:10 -0700
commit03ef71e262a8d48ba10abf9181490dc5c87c7fc3 (patch)
treea71763b3b64df5923f8494807df5ea42f875e0a1 /src/libstd/path.rs
parent48265b779fabf865a4b05f000ea1575c90e3cd73 (diff)
downloadrust-03ef71e262a8d48ba10abf9181490dc5c87c7fc3.tar.gz
rust-03ef71e262a8d48ba10abf9181490dc5c87c7fc3.zip
Add ToCStr method .with_c_str()
.with_c_str() is a replacement for the old .as_c_str(), to avoid
unnecessary boilerplate.

Replace all usages of .to_c_str().with_ref() with .with_c_str().
Diffstat (limited to 'src/libstd/path.rs')
-rw-r--r--src/libstd/path.rs6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/libstd/path.rs b/src/libstd/path.rs
index 7f53ddf6e79..de7658b5710 100644
--- a/src/libstd/path.rs
+++ b/src/libstd/path.rs
@@ -381,7 +381,7 @@ mod stat {
 #[cfg(target_os = "win32")]
 impl WindowsPath {
     pub fn stat(&self) -> Option<libc::stat> {
-        do self.to_c_str().with_ref |buf| {
+        do self.with_c_str |buf| {
             let mut st = stat::arch::default_stat();
             match unsafe { libc::stat(buf, &mut st) } {
                 0 => Some(st),
@@ -415,7 +415,7 @@ impl WindowsPath {
 #[cfg(not(target_os = "win32"))]
 impl PosixPath {
     pub fn stat(&self) -> Option<libc::stat> {
-        do self.to_c_str().with_ref |buf| {
+        do self.with_c_str |buf| {
             let mut st = stat::arch::default_stat();
             match unsafe { libc::stat(buf as *libc::c_char, &mut st) } {
                 0 => Some(st),
@@ -493,7 +493,7 @@ impl PosixPath {
 #[cfg(unix)]
 impl PosixPath {
     pub fn lstat(&self) -> Option<libc::stat> {
-        do self.to_c_str().with_ref |buf| {
+        do self.with_c_str |buf| {
             let mut st = stat::arch::default_stat();
             match unsafe { libc::lstat(buf, &mut st) } {
                 0 => Some(st),