summary refs log tree commit diff
path: root/library/alloc/src/string.rs
diff options
context:
space:
mode:
authorSprite <SpriteOvO@gmail.com>2021-12-29 13:22:35 +0800
committerSprite <SpriteOvO@gmail.com>2021-12-29 13:22:35 +0800
commita877b647173f5b372146dfad51dea2de5a4d66fe (patch)
tree7f9cd1135d27e6159082d3cacf4d88bf430efee0 /library/alloc/src/string.rs
parent7ae550842635dce84811198446fe87e830de500b (diff)
downloadrust-a877b647173f5b372146dfad51dea2de5a4d66fe.tar.gz
rust-a877b647173f5b372146dfad51dea2de5a4d66fe.zip
Fix a minor mistake in `String::try_reserve_exact` examples
Diffstat (limited to 'library/alloc/src/string.rs')
-rw-r--r--library/alloc/src/string.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/library/alloc/src/string.rs b/library/alloc/src/string.rs
index b151842458d..7c0faf0659a 100644
--- a/library/alloc/src/string.rs
+++ b/library/alloc/src/string.rs
@@ -1062,7 +1062,7 @@ impl String {
     ///     let mut output = String::new();
     ///
     ///     // Pre-reserve the memory, exiting if we can't
-    ///     output.try_reserve(data.len())?;
+    ///     output.try_reserve_exact(data.len())?;
     ///
     ///     // Now we know this can't OOM in the middle of our complex work
     ///     output.push_str(data);