about summary refs log tree commit diff
path: root/src/liballoc
diff options
context:
space:
mode:
authorDylan DPC <dylan.dpc@gmail.com>2020-04-14 23:29:53 +0200
committerGitHub <noreply@github.com>2020-04-14 23:29:53 +0200
commite2f24230a23cb6074c26a6a4b6546cb10740fb84 (patch)
tree2845c30eee378265d1da10fba4468b0658daa09d /src/liballoc
parentb5dc6e620b68665a1d0aa79ee2e2ed2dd2b4d130 (diff)
parent2c23bd491445c56d2f5e8b22df572dbf9944ee62 (diff)
downloadrust-e2f24230a23cb6074c26a6a4b6546cb10740fb84.tar.gz
rust-e2f24230a23cb6074c26a6a4b6546cb10740fb84.zip
Rollup merge of #70949 - WaffleLapkin:simlify_vec_macro, r=petrochenkov
simplify `vec!` macro

Simplify `vec!` macro by replacing 2 following branches:
- `($($x:expr),*) => (...)`
- `($($x:expr,)*) => (...)`
with one:
- `($($x:expr),* $(,)?) => (...)`

This is a minor change, however, this will make the documentation cleaner
Diffstat (limited to 'src/liballoc')
-rw-r--r--src/liballoc/macros.rs5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/liballoc/macros.rs b/src/liballoc/macros.rs
index 4bc0c3a079d..e163a166b49 100644
--- a/src/liballoc/macros.rs
+++ b/src/liballoc/macros.rs
@@ -42,10 +42,9 @@ macro_rules! vec {
     ($elem:expr; $n:expr) => (
         $crate::vec::from_elem($elem, $n)
     );
-    ($($x:expr),*) => (
-        <[_]>::into_vec(box [$($x),*])
+    ($($x:expr),+ $(,)?) => (
+        <[_]>::into_vec(box [$($x),+])
     );
-    ($($x:expr,)*) => ($crate::vec![$($x),*])
 }
 
 // HACK(japaric): with cfg(test) the inherent `[T]::into_vec` method, which is