@@ -1489,10 +1489,11 @@ impl String {
14891489 Some ( ch)
14901490 }
14911491
1492- /// Removes a [`char`] from this `String` at a byte position and returns it.
1492+ /// Removes a [`char`] from this `String` at byte position `idx` and returns it.
14931493 ///
1494- /// This is an *O*(*n*) operation, as it requires copying every element in the
1495- /// buffer.
1494+ /// Copies all bytes after the removed char to new positions.
1495+ ///
1496+ /// Note that calling this in a loop can result in quadratic behavior.
14961497 ///
14971498 /// # Panics
14981499 ///
@@ -1678,10 +1679,13 @@ impl String {
16781679 drop ( guard) ;
16791680 }
16801681
1681- /// Inserts a character into this `String` at a byte position.
1682+ /// Inserts a character into this `String` at byte position `idx`.
1683+ ///
1684+ /// Reallocates if `self.capacity()` is insufficient, which may involve copying all
1685+ /// `self.capacity()` bytes. Makes space for the insertion by copying all bytes of
1686+ /// `&self[idx..]` to new positions.
16821687 ///
1683- /// This is an *O*(*n*) operation as it requires copying every element in the
1684- /// buffer.
1688+ /// Note that calling this in a loop can result in quadratic behavior.
16851689 ///
16861690 /// # Panics
16871691 ///
@@ -1733,10 +1737,13 @@ impl String {
17331737 }
17341738 }
17351739
1736- /// Inserts a string slice into this `String` at a byte position.
1740+ /// Inserts a string slice into this `String` at byte position `idx`.
1741+ ///
1742+ /// Reallocates if `self.capacity()` is insufficient, which may involve copying all
1743+ /// `self.capacity()` bytes. Makes space for the insertion by copying all bytes of
1744+ /// `&self[idx..]` to new positions.
17371745 ///
1738- /// This is an *O*(*n*) operation as it requires copying every element in the
1739- /// buffer.
1746+ /// Note that calling this in a loop can result in quadratic behavior.
17401747 ///
17411748 /// # Panics
17421749 ///
0 commit comments