From b0190a407fe82d2c5f78fc2be65c14d13fc35e33 Mon Sep 17 00:00:00 2001 From: David Gibson Date: Wed, 21 Apr 2021 14:23:23 +1000 Subject: [PATCH] agent: Use vec![] macro rather than init-then-push We have one place where we create an empty vector then immediately push something into it. We can do this in one step using the vec![] macro, which stops clippy complaining. fixes #1611 Signed-off-by: David Gibson --- src/agent/src/netlink.rs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/agent/src/netlink.rs b/src/agent/src/netlink.rs index 5598a93865..3ab6dbaa0d 100644 --- a/src/agent/src/netlink.rs +++ b/src/agent/src/netlink.rs @@ -542,12 +542,10 @@ impl Handle { ntype: NDA_UNSPEC as u8, }, nlas: { - let mut nlas = vec![]; - - nlas.push(Nla::Destination(match ip { + let mut nlas = vec![Nla::Destination(match ip { IpAddr::V4(v4) => v4.octets().to_vec(), IpAddr::V6(v6) => v6.octets().to_vec(), - })); + })]; if !neigh.lladdr.is_empty() { nlas.push(Nla::LinkLocalAddress(