From 6d32e5ae1a7a6cf7bc28f41d4c99ed81ac6113aa Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Sun, 24 Feb 2019 20:34:24 +0100 Subject: [PATCH] prefer into_initialized over read_initialited --- src/libcore/mem.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/libcore/mem.rs b/src/libcore/mem.rs index 967a36f6f1c..4b5056c5adf 100644 --- a/src/libcore/mem.rs +++ b/src/libcore/mem.rs @@ -1321,6 +1321,9 @@ pub unsafe fn into_initialized(self) -> T { /// Reads the value from the `MaybeUninit` container. The resulting `T` is subject /// to the usual drop handling. /// + /// Whenever possible, it is preferrable to use [`into_initialized`] instead, which + /// prevents duplicating the content of the `MaybeUninit`. + /// /// # Safety /// /// It is up to the caller to guarantee that the `MaybeUninit` really is in an initialized -- 2.44.0