mirror of
https://github.com/rust-lang/rust.git
synced 2025-01-01 18:35:25 +00:00
rollup merge of #21528: tshepang/simpler-replace-example
This commit is contained in:
commit
4c25687c2b
@ -444,12 +444,9 @@ pub trait StrExt: Index<RangeFull, Output = str> {
|
||||
/// # Examples
|
||||
///
|
||||
/// ```rust
|
||||
/// let s = "Do you know the muffin man,
|
||||
/// The muffin man, the muffin man, ...".to_string();
|
||||
/// let s = "this is old";
|
||||
///
|
||||
/// assert_eq!(s.replace("muffin man", "little lamb"),
|
||||
/// "Do you know the little lamb,
|
||||
/// The little lamb, the little lamb, ...".to_string());
|
||||
/// assert_eq!(s.replace("old", "new"), "this is new");
|
||||
///
|
||||
/// // not found, so no change.
|
||||
/// assert_eq!(s.replace("cookie monster", "little lamb"), s);
|
||||
|
Loading…
Reference in New Issue
Block a user