about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2022-01-05 15:05:45 +0100
committerGitHub <noreply@github.com>2022-01-05 15:05:45 +0100
commit84e48a41d3feeb65cc90cc13fd30e3997d313535 (patch)
tree72c3d6fb39cd458273592377f004451883e17199
parent56d11a446b6d141612ff5130f0bf3366c4ace845 (diff)
parenta877b647173f5b372146dfad51dea2de5a4d66fe (diff)
downloadrust-84e48a41d3feeb65cc90cc13fd30e3997d313535.tar.gz
rust-84e48a41d3feeb65cc90cc13fd30e3997d313535.zip
Rollup merge of #92388 - SpriteOvO:master, r=Mark-Simulacrum
Fix a minor mistake in `String::try_reserve_exact` examples

The examples of `String::try_reserve_exact` didn't actually use `try_reserve_exact`, which was probably a minor mistake, and this PR fixed it.
-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);