about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbvanjoi <bohan-zhang@foxmail.com>2022-06-10 00:28:46 +0800
committerbvanjoi <bohan-zhang@foxmail.com>2022-06-10 00:28:46 +0800
commit7c861cf0adb5e2d4d457105d78c0f37b801715ab (patch)
tree3d63939cb0ad0a4fbebf492de05aca01264ce7ed
parentbe16c6166f08f9b26d854783bbd4ce8d006c8f6f (diff)
downloadrust-7c861cf0adb5e2d4d457105d78c0f37b801715ab.tar.gz
rust-7c861cf0adb5e2d4d457105d78c0f37b801715ab.zip
additional docs example for replace **all** of str
-rw-r--r--library/alloc/src/str.rs1
1 files changed, 1 insertions, 0 deletions
diff --git a/library/alloc/src/str.rs b/library/alloc/src/str.rs
index 39dfd98ddcc..d5ed2c4adf4 100644
--- a/library/alloc/src/str.rs
+++ b/library/alloc/src/str.rs
@@ -271,6 +271,7 @@ impl str {
     /// let s = "this is old";
     ///
     /// assert_eq!("this is new", s.replace("old", "new"));
+    /// assert_eq!("than an old", s.replace("is", "an"));
     /// ```
     ///
     /// When the pattern doesn't match: