From 8c7530ade81b14d48ebc7cdd5e5fbdc0d9612bbe Mon Sep 17 00:00:00 2001 From: Mahmoud Al-Qudsi Date: Wed, 23 Oct 2019 16:32:16 -0500 Subject: [PATCH 1/2] Improve documentation of `Vec::split_off(...)` The previous ordering of the sentences kept switching between the return value and the value of `self` after execution, making it hard to follow. Additionally, as rendered in the browser, the period in "`Self`. `self`" was difficult to make out as being a sentence separator and not one code block. --- src/liballoc/vec.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/liballoc/vec.rs b/src/liballoc/vec.rs index 4363314dc4580..963b012c71149 100644 --- a/src/liballoc/vec.rs +++ b/src/liballoc/vec.rs @@ -1333,10 +1333,10 @@ impl Vec { /// Splits the collection into two at the given index. /// - /// Returns a newly allocated `Self`. `self` contains elements `[0, at)`, - /// and the returned `Self` contains elements `[at, len)`. - /// - /// Note that the capacity of `self` does not change. + /// Copies the range from `[at, len)` to a newly allocated `Self` + /// and returns the result. The original `Self` will contain the + /// range from `[0, at)`. Note that the capacity of `self` does + /// not change. /// /// # Panics /// From a36c3f6f68f969da1141572531e140229bda4301 Mon Sep 17 00:00:00 2001 From: Mahmoud Al-Qudsi Date: Sat, 16 Nov 2019 14:11:08 -0600 Subject: [PATCH 2/2] Revise the text of `vec::split_off()` per review in #65739 Remove the incorrect usage of "copy" as the trait is not called. --- src/liballoc/vec.rs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/liballoc/vec.rs b/src/liballoc/vec.rs index 963b012c71149..07e4358d644c6 100644 --- a/src/liballoc/vec.rs +++ b/src/liballoc/vec.rs @@ -1333,10 +1333,9 @@ impl Vec { /// Splits the collection into two at the given index. /// - /// Copies the range from `[at, len)` to a newly allocated `Self` - /// and returns the result. The original `Self` will contain the - /// range from `[0, at)`. Note that the capacity of `self` does - /// not change. + /// Returns a newly allocated vector containing the elements in the range + /// `[at, len)`. After the call, the original vector will be left containing + /// the elements `[0, at)` with its previous capacity unchanged. /// /// # Panics ///