about summary refs log tree commit diff
path: root/src/libstd
diff options
context:
space:
mode:
authorManish Goregaokar <manishsmail@gmail.com>2015-05-17 11:55:40 +0530
committerManish Goregaokar <manishsmail@gmail.com>2015-05-17 11:55:40 +0530
commit99ed2c9f4b10d86edce0e239acfd5769fd7f7214 (patch)
tree71078bba88b28238dfc239bad22f48cf6dc602d3 /src/libstd
parent8fa94747e434b5e4b4618278286dc39baa914f32 (diff)
parente1f73b8e2bc8696f6ba21d44de7808cad861bb42 (diff)
downloadrust-99ed2c9f4b10d86edce0e239acfd5769fd7f7214.tar.gz
rust-99ed2c9f4b10d86edce0e239acfd5769fd7f7214.zip
Rollup merge of #25516 - bstrie:cstrdoc, r=alexcrichton
No need for `&b"foo"[..]` to make a CString, `"foo"` will do.
Diffstat (limited to 'src/libstd')
-rw-r--r--src/libstd/ffi/c_str.rs3
1 files changed, 1 insertions, 2 deletions
diff --git a/src/libstd/ffi/c_str.rs b/src/libstd/ffi/c_str.rs
index 04513e9d048..b83a8efe1d0 100644
--- a/src/libstd/ffi/c_str.rs
+++ b/src/libstd/ffi/c_str.rs
@@ -53,8 +53,7 @@ use vec::Vec;
 ///     fn my_printer(s: *const libc::c_char);
 /// }
 ///
-/// let to_print = &b"Hello, world!"[..];
-/// let c_to_print = CString::new(to_print).unwrap();
+/// let c_to_print = CString::new("Hello, world!").unwrap();
 /// unsafe {
 ///     my_printer(c_to_print.as_ptr());
 /// }