Skip to content

Commit e2f2423

Browse files
authored
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
2 parents b5dc6e6 + 2c23bd4 commit e2f2423

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

src/liballoc/macros.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,9 @@ macro_rules! vec {
4242
($elem:expr; $n:expr) => (
4343
$crate::vec::from_elem($elem, $n)
4444
);
45-
($($x:expr),*) => (
46-
<[_]>::into_vec(box [$($x),*])
45+
($($x:expr),+ $(,)?) => (
46+
<[_]>::into_vec(box [$($x),+])
4747
);
48-
($($x:expr,)*) => ($crate::vec![$($x),*])
4948
}
5049

5150
// HACK(japaric): with cfg(test) the inherent `[T]::into_vec` method, which is

0 commit comments

Comments
 (0)