mirror of
https://github.com/google/comprehensive-rust.git
synced 2024-12-04 11:39:42 +02:00
Merge pull request #122 from marshallpierce/patch-1
Create an empty Vec rather than pre-allocating
This commit is contained in:
commit
e074b8c87f
@ -31,7 +31,7 @@ fn log<W: Write>(writer: &mut W, msg: &str) -> Result<()> {
|
||||
}
|
||||
|
||||
fn main() -> Result<()> {
|
||||
let mut buffer = Vec::with_capacity(1024);
|
||||
let mut buffer = Vec::new();
|
||||
log(&mut buffer, "Hello")?;
|
||||
log(&mut buffer, "World")?;
|
||||
println!("Logged: {:?}", buffer);
|
||||
|
Loading…
Reference in New Issue
Block a user