Skip to content

Commit 3726918

Browse files
authored
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.
1 parent ec75f8f commit 3726918

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/memory-management/exercise.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,8 @@ impl PackageBuilder {
6565
Self(Package {
6666
name: name.into(),
6767
version: "0.1".into(),
68-
authors: vec![],
69-
dependencies: vec![],
68+
authors: Vec::new(),
69+
dependencies: Vec::new(),
7070
language: None,
7171
})
7272
}

0 commit comments

Comments
 (0)