Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clarify the description for rfind #74296

Merged
merged 1 commit into from
Jul 14, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions src/libcore/str/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3158,11 +3158,11 @@ impl str {
/// Simple patterns:
///
/// ```
/// let s = "Löwe 老虎 Léopard";
/// let s = "Löwe 老虎 Léopard Gepardi";
///
/// assert_eq!(s.find('L'), Some(0));
/// assert_eq!(s.find('é'), Some(14));
/// assert_eq!(s.find("Léopard"), Some(13));
/// assert_eq!(s.find("pard"), Some(17));
/// ```
///
/// More complex patterns using point-free style and closures:
Expand Down Expand Up @@ -3190,8 +3190,8 @@ impl str {
pat.into_searcher(self).next_match().map(|(i, _)| i)
}

/// Returns the byte index of the last character of this string slice that
/// matches the pattern.
/// Returns the byte index for the first character of the rightmost match of the pattern in
/// this string slice.
///
/// Returns [`None`] if the pattern doesn't match.
///
Expand All @@ -3207,10 +3207,11 @@ impl str {
/// Simple patterns:
///
/// ```
/// let s = "Löwe 老虎 Léopard";
/// let s = "Löwe 老虎 Léopard Gepardi";
///
/// assert_eq!(s.rfind('L'), Some(13));
/// assert_eq!(s.rfind('é'), Some(14));
/// assert_eq!(s.rfind("pard"), Some(24));
/// ```
///
/// More complex patterns with closures:
Expand Down