Skip to content

Commit 79e0543

Browse files
Use String::from_utf8_lossy in CStr demo
1 parent b4151a4 commit 79e0543

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

library/core/src/ffi/c_str.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ use crate::str;
6666
///
6767
/// fn my_string_safe() -> String {
6868
/// unsafe {
69-
/// CStr::from_ptr(my_string()).to_string_lossy().into_owned()
69+
/// String::from_utf8_lossy(CStr::from_ptr(my_string()))
7070
/// }
7171
/// }
7272
///

0 commit comments

Comments
 (0)