Skip to content

Commit 99ed2c9

Browse files
committed
Rollup merge of #25516 - bstrie:cstrdoc, r=alexcrichton
No need for `&b"foo"[..]` to make a CString, `"foo"` will do.
2 parents 8fa9474 + e1f73b8 commit 99ed2c9

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

src/libstd/ffi/c_str.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,7 @@ use vec::Vec;
5353
/// fn my_printer(s: *const libc::c_char);
5454
/// }
5555
///
56-
/// let to_print = &b"Hello, world!"[..];
57-
/// let c_to_print = CString::new(to_print).unwrap();
56+
/// let c_to_print = CString::new("Hello, world!").unwrap();
5857
/// unsafe {
5958
/// my_printer(c_to_print.as_ptr());
6059
/// }

0 commit comments

Comments
 (0)