]> git.lizzy.rs Git - rust.git/blobdiff - src/libstd/ffi/c_str.rs
stabilize `#[must_use]` for functions and must-use operators
[rust.git] / src / libstd / ffi / c_str.rs
index c88c2bc913713634aa465e8fa82830226b3802e2..d4937c00012284df935bff4f0bf8d36170310d4c 100644 (file)
@@ -988,6 +988,7 @@ pub unsafe fn from_bytes_with_nul_unchecked(bytes: &[u8]) -> &CStr {
     /// behavior when `ptr` is used inside the `unsafe` block:
     ///
     /// ```no_run
+    /// # #![allow(unused_must_use)]
     /// use std::ffi::{CString};
     ///
     /// let ptr = CString::new("Hello").unwrap().as_ptr();
@@ -1003,6 +1004,7 @@ pub unsafe fn from_bytes_with_nul_unchecked(bytes: &[u8]) -> &CStr {
     /// To fix the problem, bind the `CString` to a local variable:
     ///
     /// ```no_run
+    /// # #![allow(unused_must_use)]
     /// use std::ffi::{CString};
     ///
     /// let hello = CString::new("Hello").unwrap();