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
This commit is contained in:
Dylan DPC 2020-04-14 23:29:53 +02:00 committed by GitHub
commit e2f24230a2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 3 deletions

View File

@ -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