diff options
| author | Waffle <waffle.lapkin@gmail.com> | 2020-04-09 11:03:57 +0300 |
|---|---|---|
| committer | Waffle <waffle.lapkin@gmail.com> | 2020-04-09 11:03:57 +0300 |
| commit | 3ae2d21c12a1fbe909f72a96b012d7092c5419e4 (patch) | |
| tree | 90217a9f90256a9234a30d79b22162c140fb6710 | |
| parent | 11f6096a9ef6ad52de2956f4d2df200de7617077 (diff) | |
| download | rust-3ae2d21c12a1fbe909f72a96b012d7092c5419e4.tar.gz rust-3ae2d21c12a1fbe909f72a96b012d7092c5419e4.zip | |
simplify `vec!` macro
Simplify `vec!` macro by replacing 2 following branches: - `($($x:expr),*) => (...)` - `($($x:expr,)*) => (...)` with one: - `($($x:expr),* $(,)?) => (...)`
| -rw-r--r-- | src/liballoc/macros.rs | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/src/liballoc/macros.rs b/src/liballoc/macros.rs index 4bc0c3a079d..4a613b92ce8 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),*) => ( + ($($x:expr),* $(,)?) => ( <[_]>::into_vec(box [$($x),*]) ); - ($($x:expr,)*) => ($crate::vec![$($x),*]) } // HACK(japaric): with cfg(test) the inherent `[T]::into_vec` method, which is |
