Skip to content

Commit f31528e

Browse files
committed
Silence unused_mut warning on smallvec! macro with no args
1 parent 7187209 commit f31528e

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

lib.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,7 @@ macro_rules! smallvec {
146146
});
147147
($($x:expr),*$(,)*) => ({
148148
let count = 0usize $(+ $crate::smallvec!(@one $x))*;
149+
#[allow(unused_mut)]
149150
let mut vec = $crate::SmallVec::new();
150151
if count <= vec.inline_size() {
151152
$(vec.push($x);)*
@@ -2708,4 +2709,9 @@ mod tests {
27082709
fn const_generics() {
27092710
let _v = SmallVec::<[i32; 987]>::default();
27102711
}
2712+
2713+
#[test]
2714+
fn empty_macro() {
2715+
let _v: SmallVec<[u8; 1]> = smallvec![];
2716+
}
27112717
}

0 commit comments

Comments
 (0)