Skip to content

Commit

Permalink
Simplify CString doc comment
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
bstrie committed May 17, 2015
1 parent c23a9d4 commit e1f73b8
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/libstd/ffi/c_str.rs
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 e1f73b8

Please sign in to comment.