From 3726918b87c2c728de7274725ada8affc2b013af Mon Sep 17 00:00:00 2001 From: Nicole L Date: Wed, 23 Apr 2025 02:04:50 -0700 Subject: [PATCH] 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. --- src/memory-management/exercise.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/memory-management/exercise.rs b/src/memory-management/exercise.rs index 33c30d80..ffdb2c6c 100644 --- a/src/memory-management/exercise.rs +++ b/src/memory-management/exercise.rs @@ -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, }) }