Skip to content

Commit ab5c330

Browse files
committed
str: make replace() example more simple
1 parent b7930d9 commit ab5c330

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

src/libcollections/str.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -435,12 +435,9 @@ pub trait StrExt: Index<FullRange, Output = str> {
435435
/// # Examples
436436
///
437437
/// ```rust
438-
/// let s = "Do you know the muffin man,
439-
/// The muffin man, the muffin man, ...".to_string();
438+
/// let s = "this is old";
440439
///
441-
/// assert_eq!(s.replace("muffin man", "little lamb"),
442-
/// "Do you know the little lamb,
443-
/// The little lamb, the little lamb, ...".to_string());
440+
/// assert_eq!(s.replace("old", "new"), "this is new");
444441
///
445442
/// // not found, so no change.
446443
/// assert_eq!(s.replace("cookie monster", "little lamb"), s);

0 commit comments

Comments
 (0)