diff options
| author | Kevin Ballard <kevin@sb.org> | 2013-08-14 19:21:59 -0700 |
|---|---|---|
| committer | Kevin Ballard <kevin@sb.org> | 2013-08-15 01:33:10 -0700 |
| commit | 03ef71e262a8d48ba10abf9181490dc5c87c7fc3 (patch) | |
| tree | a71763b3b64df5923f8494807df5ea42f875e0a1 /src/libstd/sys.rs | |
| parent | 48265b779fabf865a4b05f000ea1575c90e3cd73 (diff) | |
| download | rust-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/sys.rs')
| -rw-r--r-- | src/libstd/sys.rs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/libstd/sys.rs b/src/libstd/sys.rs index 03e6412fcb8..bfb9bee7802 100644 --- a/src/libstd/sys.rs +++ b/src/libstd/sys.rs @@ -105,8 +105,8 @@ pub trait FailWithCause { impl FailWithCause for ~str { fn fail_with(cause: ~str, file: &'static str, line: uint) -> ! { - do cause.to_c_str().with_ref |msg_buf| { - do file.to_c_str().with_ref |file_buf| { + do cause.with_c_str |msg_buf| { + do file.with_c_str |file_buf| { begin_unwind_(msg_buf, file_buf, line as libc::size_t) } } @@ -115,8 +115,8 @@ impl FailWithCause for ~str { impl FailWithCause for &'static str { fn fail_with(cause: &'static str, file: &'static str, line: uint) -> ! { - do cause.to_c_str().with_ref |msg_buf| { - do file.to_c_str().with_ref |file_buf| { + do cause.with_c_str |msg_buf| { + do file.with_c_str |file_buf| { begin_unwind_(msg_buf, file_buf, line as libc::size_t) } } |
