Skip to content

Commit 37cd634

Browse files
authored
Rollup merge of #113934 - ajtribick:string-pop-remove-multibyte, r=thomcc
Multibyte character removal in String::pop and String::remove doctests I think it would be useful to have the doctests for the `String::pop()` and `String::remove()` methods demonstrate that they work on multibyte UTF-8 sequences.
2 parents 65b5cba + 2c14598 commit 37cd634

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

library/alloc/src/string.rs

+8-8
Original file line numberDiff line numberDiff line change
@@ -1290,11 +1290,11 @@ impl String {
12901290
/// Basic usage:
12911291
///
12921292
/// ```
1293-
/// let mut s = String::from("foo");
1293+
/// let mut s = String::from("abč");
12941294
///
1295-
/// assert_eq!(s.pop(), Some('o'));
1296-
/// assert_eq!(s.pop(), Some('o'));
1297-
/// assert_eq!(s.pop(), Some('f'));
1295+
/// assert_eq!(s.pop(), Some('č'));
1296+
/// assert_eq!(s.pop(), Some('b'));
1297+
/// assert_eq!(s.pop(), Some('a'));
12981298
///
12991299
/// assert_eq!(s.pop(), None);
13001300
/// ```
@@ -1324,11 +1324,11 @@ impl String {
13241324
/// Basic usage:
13251325
///
13261326
/// ```
1327-
/// let mut s = String::from("foo");
1327+
/// let mut s = String::from("abç");
13281328
///
1329-
/// assert_eq!(s.remove(0), 'f');
1330-
/// assert_eq!(s.remove(1), 'o');
1331-
/// assert_eq!(s.remove(0), 'o');
1329+
/// assert_eq!(s.remove(0), 'a');
1330+
/// assert_eq!(s.remove(1), 'ç');
1331+
/// assert_eq!(s.remove(0), 'b');
13321332
/// ```
13331333
#[inline]
13341334
#[stable(feature = "rust1", since = "1.0.0")]

0 commit comments

Comments
 (0)