From a877b647173f5b372146dfad51dea2de5a4d66fe Mon Sep 17 00:00:00 2001 From: Sprite Date: Wed, 29 Dec 2021 13:22:35 +0800 Subject: [PATCH] Fix a minor mistake in `String::try_reserve_exact` examples --- library/alloc/src/string.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/alloc/src/string.rs b/library/alloc/src/string.rs index b151842458d35..7c0faf0659a2c 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);