1
0
mirror of https://github.com/google/comprehensive-rust.git synced 2025-06-11 03:47:30 +02:00

Use Vec::new instead of vec! (#2712)

Using the `vec!` macro to create an empty `Vec` is a bit weird imo,
generally I only see the macro used when you actually want to initialize
the `Vec` with some values (like is done in the examples for this
exercise). Students are more likely to use `Vec::new`, and I think
that's the more idiomatic approach, so I think using `Vec::new` here
would be better.
This commit is contained in:
Nicole L 2025-04-23 02:04:50 -07:00 committed by GitHub
parent ec75f8f8ab
commit 3726918b87
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -65,8 +65,8 @@ impl PackageBuilder {
Self(Package {
name: name.into(),
version: "0.1".into(),
authors: vec![],
dependencies: vec![],
authors: Vec::new(),
dependencies: Vec::new(),
language: None,
})
}