diff options
| author | Christian Poveda <christianpoveda@protonmail.com> | 2017-10-17 20:11:03 -0500 |
|---|---|---|
| committer | Christian Poveda <christianpoveda@protonmail.com> | 2017-10-17 20:11:03 -0500 |
| commit | da7aab6e51fd06ea6628324b3be5ab88a4abda4f (patch) | |
| tree | a21ad780de431d67b01d7cb31afa08024d98f6ff /src/liballoc | |
| parent | 90691c8c1f8b4ece2a4f831a130ae087056b0083 (diff) | |
| download | rust-da7aab6e51fd06ea6628324b3be5ab88a4abda4f.tar.gz rust-da7aab6e51fd06ea6628324b3be5ab88a4abda4f.zip | |
added examples of closures
Diffstat (limited to 'src/liballoc')
| -rw-r--r-- | src/liballoc/str.rs | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/liballoc/str.rs b/src/liballoc/str.rs index 830128f2b9f..3e273a67000 100644 --- a/src/liballoc/str.rs +++ b/src/liballoc/str.rs @@ -959,13 +959,15 @@ impl str { /// assert_eq!(s.find("Léopard"), Some(13)); /// ``` /// - /// More complex patterns with closures: + /// More complex patterns using point-free style and closures: /// /// ``` /// let s = "Löwe 老虎 Léopard"; /// /// assert_eq!(s.find(char::is_whitespace), Some(5)); /// assert_eq!(s.find(char::is_lowercase), Some(1)); + /// assert_eq!(s.find(|c: char| c.is_whitespace()), Some(5)); + /// assert_eq!(s.find(|c: char| c.is_lowercase()), Some(1)); /// ``` /// /// Not finding the pattern: |
