about summary refs log tree commit diff
diff options
context:
space:
mode:
authorAndrew Tribick <ajtribick@googlemail.com>2023-07-21 23:40:55 +0200
committerAndrew Tribick <ajtribick@googlemail.com>2023-07-21 23:40:55 +0200
commit2c145982a519f78f81930fc16e7fef46f485d266 (patch)
treeffd74c3fd774c682be65b6900c78abe7c833202f
parentc3c5a5c5f7a0cf9acdfe60440a1e1fa68a1c1278 (diff)
downloadrust-2c145982a519f78f81930fc16e7fef46f485d266.tar.gz
rust-2c145982a519f78f81930fc16e7fef46f485d266.zip
Demonstrate multibyte character removal in String::pop and String::remove doctests
-rw-r--r--library/alloc/src/string.rs16
1 files changed, 8 insertions, 8 deletions
diff --git a/library/alloc/src/string.rs b/library/alloc/src/string.rs
index ad7b77f5497..0019f51b3d7 100644
--- a/library/alloc/src/string.rs
+++ b/library/alloc/src/string.rs
@@ -1290,11 +1290,11 @@ impl String {
     /// Basic usage:
     ///
     /// ```
-    /// let mut s = String::from("foo");
+    /// let mut s = String::from("abč");
     ///
-    /// assert_eq!(s.pop(), Some('o'));
-    /// assert_eq!(s.pop(), Some('o'));
-    /// assert_eq!(s.pop(), Some('f'));
+    /// assert_eq!(s.pop(), Some('č'));
+    /// assert_eq!(s.pop(), Some('b'));
+    /// assert_eq!(s.pop(), Some('a'));
     ///
     /// assert_eq!(s.pop(), None);
     /// ```
@@ -1324,11 +1324,11 @@ impl String {
     /// Basic usage:
     ///
     /// ```
-    /// let mut s = String::from("foo");
+    /// let mut s = String::from("abç");
     ///
-    /// assert_eq!(s.remove(0), 'f');
-    /// assert_eq!(s.remove(1), 'o');
-    /// assert_eq!(s.remove(0), 'o');
+    /// assert_eq!(s.remove(0), 'a');
+    /// assert_eq!(s.remove(1), 'ç');
+    /// assert_eq!(s.remove(0), 'b');
     /// ```
     #[inline]
     #[stable(feature = "rust1", since = "1.0.0")]