From 32a3edb153f46d2864db0a5e6894a2e2ab8e3d52 Mon Sep 17 00:00:00 2001 From: Tommaso Fontana Date: Mon, 25 Oct 2021 13:51:34 +0200 Subject: [PATCH 1/2] Changed slice.swap documentation for better readability using "b" and "d" can be easily confused --- library/core/src/slice/mod.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/library/core/src/slice/mod.rs b/library/core/src/slice/mod.rs index aaa00653b99c2..92b1e1d75c660 100644 --- a/library/core/src/slice/mod.rs +++ b/library/core/src/slice/mod.rs @@ -553,9 +553,9 @@ impl [T] { /// # Examples /// /// ``` - /// let mut v = ["a", "b", "c", "d"]; - /// v.swap(1, 3); - /// assert!(v == ["a", "d", "c", "b"]); + /// let mut v = ["a", "b", "c", "d", "e]; + /// v.swap(2, 4); + /// assert!(v == ["a", "b", "e", "d", "c"]); /// ``` #[stable(feature = "rust1", since = "1.0.0")] #[inline] From 9b28ab40acd55b5d26b6fcdae75873ea321f696d Mon Sep 17 00:00:00 2001 From: Tommaso Fontana Date: Mon, 25 Oct 2021 14:13:54 +0200 Subject: [PATCH 2/2] Fixed missing double quote in the patch (slice.swap) --- library/core/src/slice/mod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/core/src/slice/mod.rs b/library/core/src/slice/mod.rs index 92b1e1d75c660..a6370a4513bb5 100644 --- a/library/core/src/slice/mod.rs +++ b/library/core/src/slice/mod.rs @@ -553,7 +553,7 @@ impl [T] { /// # Examples /// /// ``` - /// let mut v = ["a", "b", "c", "d", "e]; + /// let mut v = ["a", "b", "c", "d", "e"]; /// v.swap(2, 4); /// assert!(v == ["a", "b", "e", "d", "c"]); /// ```