Skip to content

Commit 34fe201

Browse files
committed
Fix some str docs to refer to patterns
1 parent e7f3d6e commit 34fe201

File tree

1 file changed

+13
-10
lines changed

1 file changed

+13
-10
lines changed

src/libcollections/str.rs

+13-10
Original file line numberDiff line numberDiff line change
@@ -857,9 +857,10 @@ impl str {
857857
Utf16Units { encoder: Utf16Encoder::new(self[..].chars()) }
858858
}
859859

860-
/// Returns `true` if the given `&str` is a sub-slice of this string slice.
860+
/// Returns `true` if the given pattern matches a sub-slice of
861+
/// this string slice.
861862
///
862-
/// Returns `false` if it's not.
863+
/// Returns `false` if it does not.
863864
///
864865
/// # Examples
865866
///
@@ -876,9 +877,10 @@ impl str {
876877
core_str::StrExt::contains(self, pat)
877878
}
878879

879-
/// Returns `true` if the given `&str` is a prefix of this string slice.
880+
/// Returns `true` if the given pattern matches a prefix of this
881+
/// string slice.
880882
///
881-
/// Returns `false` if it's not.
883+
/// Returns `false` if it does not.
882884
///
883885
/// # Examples
884886
///
@@ -895,9 +897,10 @@ impl str {
895897
core_str::StrExt::starts_with(self, pat)
896898
}
897899

898-
/// Returns `true` if the given `&str` is a suffix of this string slice.
900+
/// Returns `true` if the given pattern matches a suffix of this
901+
/// string slice.
899902
///
900-
/// Returns `false` if not.
903+
/// Returns `false` if it does not.
901904
///
902905
/// # Examples
903906
///
@@ -1681,11 +1684,11 @@ impl str {
16811684
core_str::StrExt::parse(self)
16821685
}
16831686

1684-
/// Replaces all occurrences of one string with another.
1687+
/// Replaces all matches of a pattern with another string.
16851688
///
16861689
/// `replace` creates a new [`String`], and copies the data from this string slice into it.
1687-
/// While doing so, it attempts to find a sub-`&str`. If it finds it, it replaces it with
1688-
/// the replacement string slice.
1690+
/// While doing so, it attempts to find matches of a pattern. If it finds any, it
1691+
/// replaces them with the replacement string slice.
16891692
///
16901693
/// [`String`]: string/struct.String.html
16911694
///
@@ -1699,7 +1702,7 @@ impl str {
16991702
/// assert_eq!("this is new", s.replace("old", "new"));
17001703
/// ```
17011704
///
1702-
/// When a `&str` isn't found:
1705+
/// When the pattern doesn't match:
17031706
///
17041707
/// ```
17051708
/// let s = "this is old";

0 commit comments

Comments
 (0)