提交 ba05ca69 编写于 作者: H Huon Wilson

std: stop `vec!()` warning about unused mutability.

If no arguments are given to `vec!` then no pushes are emitted and
so the compiler (rightly) complains that the mutability of `temp` is
never used.

This behaviour is rather annoying for users.
上级 28e7631d
......@@ -366,12 +366,14 @@ fn run_fmt(fmt: &::std::fmt::Arguments) -> ! {
($e:expr) => (match $e { Ok(e) => e, Err(e) => return Err(e) })
)
/// Create a `std::vec_ng::Vec` containing the arguments.
#[macro_export]
macro_rules! vec(
($($e:expr),*) => ({
let mut temp = ::std::vec_ng::Vec::new();
$(temp.push($e);)*
temp
// leading _ to allow empty construction without a warning.
let mut _temp = ::std::vec_ng::Vec::new();
$(_temp.push($e);)*
_temp
})
)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册