Skip to content

Commit

Permalink
expand vec![] to Vec::new()
Browse files Browse the repository at this point in the history
  • Loading branch information
tspiteri committed Mar 31, 2020
1 parent 75ff311 commit 4d8273d
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/liballoc/macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@
#[stable(feature = "rust1", since = "1.0.0")]
#[allow_internal_unstable(box_syntax)]
macro_rules! vec {
() => (
$crate::vec::Vec::new()
);
($elem:expr; $n:expr) => (
$crate::vec::from_elem($elem, $n)
);
Expand All @@ -51,6 +54,9 @@ macro_rules! vec {
// NB see the slice::hack module in slice.rs for more information
#[cfg(test)]
macro_rules! vec {
() => (
$crate::vec::Vec::new()
);
($elem:expr; $n:expr) => (
$crate::vec::from_elem($elem, $n)
);
Expand Down

0 comments on commit 4d8273d

Please sign in to comment.