Skip to content

Commit

Permalink
Rollup merge of rust-lang#25516 - bstrie:cstrdoc, r=alexcrichton
Browse files Browse the repository at this point in the history
No need for `&b"foo"[..]` to make a CString, `"foo"` will do.
  • Loading branch information
Manishearth committed May 17, 2015
2 parents 8fa9474 + e1f73b8 commit 99ed2c9
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/libstd/ffi/c_str.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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());
/// }
Expand Down

0 comments on commit 99ed2c9

Please sign in to comment.