mirror of
https://github.com/rust-lang/rust.git
synced 2025-02-04 19:12:50 +00:00
Fix a minor mistake in String::try_reserve_exact
examples
This commit is contained in:
parent
7ae5508426
commit
a877b64717
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user