@@ -527,19 +527,15 @@ impl<T> MaybeUninit<T> {
527527 ///
528528 /// ```rust
529529 /// #![feature(maybe_uninit_ref)]
530- /// use :: std::mem::MaybeUninit;
530+ /// use std::mem::MaybeUninit;
531531 ///
532532 /// let mut x = MaybeUninit::<Vec<u32>>::uninit();
533533 /// // Initialize `x`:
534534 /// unsafe { x.as_mut_ptr().write(vec![1, 2, 3]); }
535- /// /* The above line can also be done without unsafe:
536- /// x = MaybeUninit::new(vec![1, 2, 3]); // */
537535 /// // Now that our `MaybeUninit<_>` is known to be initialized, it is okay to
538536 /// // create a shared reference to it:
539537 /// let x: &Vec<u32> = unsafe {
540- /// // # Safety
541- /// //
542- /// // - `x` has been initialized.
538+ /// // Safety: `x` has been initialized.
543539 /// x.get_ref()
544540 /// };
545541 /// assert_eq!(x, &vec![1, 2, 3]);
@@ -594,27 +590,25 @@ impl<T> MaybeUninit<T> {
594590 ///
595591 /// ```rust
596592 /// #![feature(maybe_uninit_ref)]
597- /// use :: std::mem::MaybeUninit;
593+ /// use std::mem::MaybeUninit;
598594 ///
599- /// # unsafe extern "C" fn initialize_buffer (buf: *mut [u8; 2048]) { *buf = [0; 2048] }
595+ /// # unsafe extern "C" fn initialize_buffer(buf: *mut [u8; 2048]) { *buf = [0; 2048] }
600596 /// # #[cfg(FALSE)]
601597 /// extern "C" {
602598 /// /// Initializes *all* the bytes of the input buffer.
603- /// fn initialize_buffer (buf: *mut [u8; 2048]);
599+ /// fn initialize_buffer(buf: *mut [u8; 2048]);
604600 /// }
605601 ///
606602 /// let mut buf = MaybeUninit::<[u8; 2048]>::uninit();
607603 ///
608604 /// // Initialize `buf`:
609605 /// unsafe { initialize_buffer(buf.as_mut_ptr()); }
610- /// // Now we know that `buf` has been initialized; so we could `.assume_init()` it.
606+ /// // Now we know that `buf` has been initialized, so we could `.assume_init()` it.
611607 /// // However, using `.assume_init()` may trigger a `memcpy` of the 2048 bytes.
612608 /// // To assert our buffer has been initialized without copying it, we upgrade
613609 /// // the `&mut MaybeUninit<[u8; 2048]>` to a `&mut [u8; 2048]`:
614610 /// let buf: &mut [u8; 2048] = unsafe {
615- /// // # Safety
616- /// //
617- /// // - `buf` has been initialized.
611+ /// // Safety: `buf` has been initialized.
618612 /// buf.get_mut()
619613 /// };
620614 ///
0 commit comments