diff options
| author | Pietro Albini <pietro@pietroalbini.org> | 2019-11-05 09:49:56 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-11-05 09:49:56 +0100 |
| commit | d32a262ab8ec6d81f443b5d73b549361221c8d4e (patch) | |
| tree | 5345afd55cfb64995e9cf97a2cd3bca5aa38096d /src/libcore | |
| parent | c25975d3277a6941bd0b2ed4f46a9cc6a8540d80 (diff) | |
| parent | d9ec5fa88ca0c082aa2089b372e7981f9d514e82 (diff) | |
| download | rust-d32a262ab8ec6d81f443b5d73b549361221c8d4e.tar.gz rust-d32a262ab8ec6d81f443b5d73b549361221c8d4e.zip | |
Rollup merge of #66038 - jdxcode:char-len, r=alexcrichton
doc(str): show example of chars().count() under len() the docs are great at explaining that .len() isn't like in other languages but stops short of explaining how to get the character length.
Diffstat (limited to 'src/libcore')
| -rw-r--r-- | src/libcore/str/mod.rs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/libcore/str/mod.rs b/src/libcore/str/mod.rs index f67012d8f2f..1968919f554 100644 --- a/src/libcore/str/mod.rs +++ b/src/libcore/str/mod.rs @@ -2085,8 +2085,8 @@ impl str { /// let len = "foo".len(); /// assert_eq!(3, len); /// - /// let len = "ƒoo".len(); // fancy f! - /// assert_eq!(4, len); + /// assert_eq!("ƒoo".len(), 4); // fancy f! + /// assert_eq!("ƒoo".chars().count(), 3); /// ``` #[stable(feature = "rust1", since = "1.0.0")] #[inline] |
