@@ -46,9 +46,9 @@ use crate::str;
4646/// use std::ffi::CStr;
4747/// use std::os::raw::c_char;
4848///
49- /// # #[cfg(any())] // Extern functions are awkward in doc comments - fake it instead
49+ /// # /* Extern functions are awkward in doc comments - fake it instead
5050/// extern "C" { fn my_string() -> *const c_char; }
51- /// # unsafe extern "C" fn my_string() -> *const c_char { c"hello".as_ptr() }
51+ /// # */ unsafe extern "C" fn my_string() -> *const c_char { c"hello".as_ptr() }
5252///
5353/// unsafe {
5454/// let slice = CStr::from_ptr(my_string());
@@ -63,9 +63,9 @@ use crate::str;
6363/// use std::os::raw::c_char;
6464///
6565/// fn work(data: &CStr) {
66- /// # #[cfg(any())] // Extern functions are awkward in doc comments - fake it instead
66+ /// # /* Extern functions are awkward in doc comments - fake it instead
6767/// extern "C" { fn work_with(data: *const c_char); }
68- /// # unsafe extern "C" fn work_with(s: *const c_char) {}
68+ /// # */ unsafe extern "C" fn work_with(s: *const c_char) {}
6969///
7070/// unsafe { work_with(data.as_ptr()) }
7171/// }
@@ -80,9 +80,9 @@ use crate::str;
8080/// use std::ffi::CStr;
8181/// use std::os::raw::c_char;
8282///
83- /// # #[cfg(any())] // Extern functions are awkward in doc comments - fake it instead
83+ /// # /* Extern functions are awkward in doc comments - fake it instead
8484/// extern "C" { fn my_string() -> *const c_char; }
85- /// # unsafe extern "C" fn my_string() -> *const c_char { c"hello".as_ptr() }
85+ /// # */ unsafe extern "C" fn my_string() -> *const c_char { c"hello".as_ptr() }
8686///
8787/// fn my_string_safe() -> String {
8888/// let cstr = unsafe { CStr::from_ptr(my_string()) };
@@ -258,7 +258,7 @@ impl CStr {
258258 ///
259259 /// unsafe {
260260 /// let slice = CStr::from_ptr(my_string());
261- /// println!("string returned: {}", slice.to_str().unwrap());
261+ /// assert_eq!( slice.to_str().unwrap(), "hello" );
262262 /// }
263263 /// ```
264264 ///
0 commit comments